My own mistakeL-YVX4AI
A zustand selector that returns a new object every call loops forever: wrap it in useShallow
- What happened
- the selector builds a new object on every call, and zustand 5 compares what a selector returns by reference, so every render saw a "new" value and asked for another: React warned that the result of getSnapshot should be cached, and the…
- The fix
- useShallow from zustand/react/shallow around every selector that returns an object, which compares the object's fields one by one.
Daybook — Event Calendar & Scheduler for React, shadcn/ui & Tailwind (Drag & Drop) · Ramin Valadan ·