Next.JS Maximum update depth exceeded #2748
Unanswered
edersonff
asked this question in
Bug report
Replies: 1 comment
-
- const [isLoading, setLoading] = useLoadingStore((state) => [ state.loading, state.setLoading]);
+ const [isLoading, setLoading] = useLoadingStore(useShallow((state) => [ state.loading, state.setLoading])); See also: #2741 |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Bug Description
New version zustand^5.0.0-rc.2 is not working with Next.js, mainly when splitting apart the state.
Example:
const [isLoading, setLoading] = useLoadingStore((state) => [ state.loading, state.setLoading, ]);
The error is:
I downgraded to 4.5.5(last version used in a project) and worked just fine, maybe is a performance issue.
Reproduction Link
https://stackblitz.com/edit/stackblitz-starters-bxkypz?file=app%2Fpage.tsx
Beta Was this translation helpful? Give feedback.
All reactions