fix(middleware/persist): Merge storage value with the latest store state (#894)
Before adoption: this commit came in with the history the project adopted, so no landing records it.
* Merge storage value with the latest store state When using zustand store with Provider and Context, it's possible to mutate the store state in an useEffect callback before hydration creates `stateFromStorage`. It should merge the storage value with the latest store state instead of the config result since it can be out of date. * fix tests * Add test * commit
This commit
State
Before adoption: this commit came in with the history the project adopted, so no landing records it.
Trailers
- Co-authored-by: Zero Liu <zerolxy@gmail.com>
Diff stats
2 files+57 added−1 removed
- tests:+53 added−0 removed
- other:+4 added−1 removed