Zustand state is cleared during Next.js deployment #55941
-
I have encountered an event in a production Next.js application, where the Zustand state was cleared during deployment. Next.js seems to use the Automatic Updates mechanism to automatically modernize client-side JavaScript without reloading if the latest version exists. Does this destroy objects referenced by libraries like Zustand that are running outside of React?
|
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 8 replies
-
This sounds weird. I guess your zustand store is setup in _app? And it gets props calculated either by gIP, or GSP, or GSSP? Then maybe when the JSON for a page is pre-fetched, and then you navigate into the page, the props that drive the zustand store get reset? |
Beta Was this translation helpful? Give feedback.
@uki1014 ah, of course. That's what I was after initially, but at _app level.
Good that you got it!