You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I was playing around with my own progress bar implementation while referencing this library, and I discovered that you don't actually have to call startProgress in the same callback with the task you're trying to track:
exportdefaultfunctionPage(){return(<formaction={async()=>{"use server";// Play with the timeout value below to test if progress bar is accurateawaitnewPromise((r)=>setTimeout(r,7000));}}><Buttontype="submit">Submit!</Button></form>);}
The text was updated successfully, but these errors were encountered:
I was playing around with my own progress bar implementation while referencing this library, and I discovered that you don't actually have to call
startProgress
in the same callback with the task you're trying to track:I have no idea why this even works though. I tested it with heavy network throttling and everything seems perfectly sound.
If this is actually a good approach, it would eliminate the need to duplicate
Link
's logic (like the current URL formatter).Would appreciate more eyes on this though (and maybe an explanation too).
EDIT: Also works for submit buttons in server action forms:
button.tsx
page.tsx
The text was updated successfully, but these errors were encountered: