-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Feedback Request] Does Zustand v5-rc work for you? #2741
Comments
Yes, this is the last resort I can think of to get some feedback. related tweet
|
@dai-shi I have updated the comment above with how I use zustand. It's a new and simple app. Do I have to provide a Fallback for all selectors? That would be so unnecessary, wouldn't it be? |
This looks bad. Even with v4, this can cause extra re-renders. So, in that sense, v5 catches such bugs.
In this case, that wouldn't solve it anyway. |
So |
True. |
-const [searchValue, setSearchValue] = useStore((state) => [state.searchValue, state.setSearchValue]);
+const searchValue = useStore((state) => state.searchValue);
+const setSearchValue = useStore((state) => state.setSearchValue); Is this the only way to make the selector references stable? Is it possible to group them together to reduce boilerplate and function calls? |
@pavitra-infocusp sure const [searchValue, setSearchValue] = useStore(useShallow((state) => [state.searchValue, state.setSearchValue])); |
Thanks @dai-shi and @dbritto-dev! Zustand v5 is now working fine. |
I was having troubles as well on 5.0.0 rc2 where v4.5.5 was working fine (or at least, not telling me there was issues but was running fine). I spent a few hours trying to find the culprit because the error logs where completely useless.
I had to use useShallow, that's it. Now I need to go see what this is all about to understand why this suddenly happened. from:
to:
|
Thanks for reporting! This is a bit unexpected to me, as my assumption was it can cause the infinite loop even in v4. I think we need to clarify this in the v5 migration guide. 👉 #2749 |
typescript error when using with immer middleware and slice pattern.
|
How to Install
Migration Guide
https://github.com/pmndrs/zustand/blob/main/docs/migrations/migrating-to-v5.md
How to respond
Add comments to this issue or add reactions to this issue comment.
👍 : I've tested v5-rc and it works fine for me.
👎 : I've tested v5-rc and found an issue. < Comment below!
👀 : I'll try it later.
The text was updated successfully, but these errors were encountered: