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

Fix useHookstate store switchover #409

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

speigg
Copy link
Contributor

@speigg speigg commented May 16, 2024

This PR adds support for store switchovers to useHookstate() for global and nested state. Local state behavior remains unchanged. Additionally, setting state after unmount no longer throws an error, which is more in line w/ how React's built-in useState hook works.

TLDR; Eliminated HOOKSTATE-111 and HOOKSTATE-106 exceptions.

closes #364

@speigg speigg force-pushed the fix-InitStateStoreSwitchover branch from ac337e2 to 139b9e2 Compare May 16, 2024 05:08
@avkonst
Copy link
Owner

avkonst commented Jun 23, 2024

Hi @speigg ... could you please let me know if you are planning to address my comments?

@speigg
Copy link
Contributor Author

speigg commented Jul 3, 2024

Hi @avkonst I'd be happy to address your comments as soon as I have finished taking care of other things on my plate. Might take me another week to get to this.

@speigg
Copy link
Contributor Author

speigg commented Dec 20, 2024

Should be good now. Apologies for the long delay.

@speigg
Copy link
Contributor Author

speigg commented Dec 20, 2024

As I mentioned in a comment above, I removed the HOOKSTATE-106 warning entirely, as the warnings were excessive in our usage, and there are legitimate reasons for updating global state while a component unmounts (updating hooked global state on unmount).

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

Successfully merging this pull request may close these issues.

Prevent HOOKSTATE-111 exception being raised during Vite and NextJS HMR
2 participants