Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Server action mutation doesn't flush updates until the action finishes #2653

Closed
keyz opened this issue Jun 4, 2023 · 5 comments · Fixed by #2654 or #2691
Closed

Server action mutation doesn't flush updates until the action finishes #2653

keyz opened this issue Jun 4, 2023 · 5 comments · Fixed by #2654 or #2691

Comments

@keyz
Copy link

keyz commented Jun 4, 2023

Bug report

Description / Observed Behavior

(see repro below)

I'm experimenting with using (abusing? 🤔) a server action as a mutation fetcher, and I found that a server action mutation doesn't flush updates until the action finishes.

My hypothesis is it probably has something to do with both swr and React marking the update as a transition, therefore starving the update, but I haven't got to the bottom of it yet; wanted to open an issue early to see if y'all have any feedback/thoughts.

Expected Behavior

The mutation should flush an isMutating update immediately

Repro Steps / Code Example

https://codesandbox.io/p/sandbox/determined-dubinsky-wgf568?file=%2Fsrc%2Fapp%2Fpage.tsx%3A17%2C19

  • The first "trigger" button doesn't flush updates until the action finishes
  • The second "trigger" updates isMutating immediately as expected
image

Additional Context

Tested on latest canary versions:

  • swr: 2.2.0-beta.0
  • next: 13.4.5-canary.4
@promer94
Copy link
Collaborator

promer94 commented Jun 5, 2023

Thanks for your repro !

@keyz
Copy link
Author

keyz commented Jun 7, 2023

Thanks for the quick turnaround @promer94 -- would love to see a new beta release :)

@promer94
Copy link
Collaborator

promer94 commented Jun 7, 2023

We have a plan to release a new version in this week.

You could use codesandbox ci build in case you need it now 😁

@keyz
Copy link
Author

keyz commented Jun 7, 2023

Amazing, thank you!

@huozhi
Copy link
Member

huozhi commented Jun 20, 2023

Reopen this issue as reverted in #2681
x-ref: #2654 (comment)

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
3 participants