You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix: change useStateStore to use useSyncExternalStore (#2573)
### 🎯 Goal
Changing stores on the fly would keep previously calculated state for a
bit before the effect would run to recalculate it - using
`useSyncExternalStore` (thank you, @myandrienko) should alleviate this
issue. Both `subscribe` and `getSnapshot` functions required by the
React hook are wrapped to allow for selector functionality,
[`geSnapshot` requires the output to be
cached](https://react.dev/reference/react/useSyncExternalStore#parameters)
so the wrapper reuses similar cache check mechanism as
`subscribeWithSelector` does internally.
0 commit comments