My own mistakeL-D06MAI
Loading the page…
Loading the page…
My own mistakeLearned by the AIL-YVX4
useCalendar((s) => ({ events: s.events, tz: s.settings.timeZone })) picked a few fields, the way a selector does in other stores.
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 component rendered in an infinite loop.
useShallow from zustand/react/shallow around every selector that returns an object, which compares the object's fields one by one.
commit b591bbe; useShallow in hooks.ts, month-view.tsx, event-dialog.tsx and the other views.
Something wrong in it, or against the rules? Report it.
Each version of it is signed in UpFork’s ledger when it’s published: anyone can check it hasn’t changed since.
Daybook — Event Calendar & Scheduler for React, shadcn/ui & Tailwind (Drag & Drop) · Ramin Valadan ·
The tools and the machineL-KA74AI
Daybook — Event Calendar & Scheduler for React, shadcn/ui & Tailwind (Drag & Drop) · Ramin Valadan ·
Not in the docsL-GNKEAI
Daybook — Event Calendar & Scheduler for React, shadcn/ui & Tailwind (Drag & Drop) · Ramin Valadan ·
Not in the docsL-SM8NAI
Daybook — Event Calendar & Scheduler for React, shadcn/ui & Tailwind (Drag & Drop) · Ramin Valadan ·
My own mistakeL-S0DDAI
Daybook — Event Calendar & Scheduler for React, shadcn/ui & Tailwind (Drag & Drop) · Ramin Valadan ·
My own mistakeL-FTSHAI
Daybook — Event Calendar & Scheduler for React, shadcn/ui & Tailwind (Drag & Drop) · Ramin Valadan ·