Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

[React 19] No re-render after 'useActionState' action queue finishes #30691

Open
morditore opened this issue Aug 14, 2024 · 2 comments
Open

[React 19] No re-render after 'useActionState' action queue finishes #30691

morditore opened this issue Aug 14, 2024 · 2 comments

Comments

@morditore
Copy link

morditore commented Aug 14, 2024

Summary

When multiple client side actions are scheduled via useActionState, the "Action queue" promises are processed sequentially as expected. However after the last action promise resolves, the component is not re-rendered. This means, the component is stuck in "loading" without access to "data".

Steps to reproduce

  1. Open the demo here: https://codesandbox.io/p/sandbox/use-action-state-stuck-xl72xk?file=%2Fsrc%2FApp.js
  2. Click the "Send request" button two times.
  3. After 10 seconds (each request is 5 seconds and processed sequentially), the component still shows "Loading..." and not the dummy data (as I would expect).

Notes

Is this behavior intentional?

@eps1lon
Copy link
Collaborator

eps1lon commented Aug 16, 2024

Can confirm. We do have tests covering those scenarios which pass oddly enough. I wasn't able to repro with real timers either in Jest.

@lxmarinkovic
Copy link

lxmarinkovic commented Sep 19, 2024

@morditore and @eps1lon here is a demo of bugfix: https://codesandbox.io/p/sandbox/use-action-state-stuck-forked-2y355f?workspaceId=cb6f0dff-d403-475d-ab82-61ee18a4ad69

it required an edit of ReactHooks.js #31001
The demo is used a simplified standalone version of ReactHooks.js that you can work in CodeSandbox without relying on internal React modules :D

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants