pmndrs / zustand

🐻 Bear necessities for state management in React

Home Page:https://zustand-demo.pmnd.rs/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

docs: Add suggestions about getInitialState on persist

Cadienvan opened this issue · comments

The persist middleware alters the behavior of getInitialState because of internal reasons mentioned in #2277.
When following the documentation here while having a persisted state accompanied by a non-persisted one, the suggestion about getInitialState in the vite's afterEach lifecycle method isn't applicable.

Here's an example:
Screenshot 2024-02-29 alle 14 51 44

Our service slice is persisted, while the remaining 3 aren't, so our getInitialState will only contain the createServiceSlice slice of the state.

I'd love to mention it in a PR if you have any idea about how to properly handle this.