Replies: 3 comments 8 replies
-
This is what I have been wondering and I decided to change "delayInit=true" by default in the next Jotai version's So, can you confirm if zustand v4.2.0 before #1518 actually works as you expect? |
Beta Was this translation helpful? Give feedback.
-
I agree with this - so far the only solution to this is preventing the page to render if it's not mounted yet. It feels hacky to create a custom hook to check if the page is mounted before rendering to prevent hydration errors. |
Beta Was this translation helpful? Give feedback.
-
https://twitter.com/dai_shi/status/1716304792786747646 I don't think we should add a new option Instead, we should explore the use of Would anyone be able to help? I think we need a minimal repro first. |
Beta Was this translation helpful? Give feedback.
-
The problem
With frameworks that do hydration like Next.js, we have the following flow:
/my-page
where there is no persisted store (localStorage), therefore the default values are used and renders the page with them.Proposal
It would be beneficial to include an option to set if the persisted store should be initiated with values (sync) or not (async).
This should make the storage async by default, meaning on the first render the persisted values will be
undefined
, matching what was rendered on the server and therefore, potentially avoiding the Rehydration error. Thoughts?Beta Was this translation helpful? Give feedback.
All reactions