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

#30691 bugfix #31001

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Conversation

lxmarinkovic
Copy link

@lxmarinkovic lxmarinkovic commented Sep 19, 2024

@gsathya @yungsters @kassens please review

Updated ReactHooks.js to fix issue #30691

Explanation:
Action State Hook (useActionState): I've modified the useActionState hook to ensure that the setState() method is called upon resolving each action, which provides a re-render and data being accessible.
Handling Multiple Requests: The state is updated after each asynchronous action resolves, avoiding the scenario where multiple actions prevent the final state from reflecting correctly.

demo of problematic issue: https://codesandbox.io/p/sandbox/use-action-state-stuck-xl72xk?file=%2Fsrc%2FApp.js

demo of fix: https://codesandbox.io/p/sandbox/use-action-state-stuck-forked-2y355f?workspaceId=cb6f0dff-d403-475d-ab82-61ee18a4ad69

Copy link

vercel bot commented Sep 19, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
react-compiler-playground ✅ Ready (Inspect) Visit Preview 💬 Add feedback Sep 19, 2024 11:29am

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

Successfully merging this pull request may close these issues.

2 participants