[BP1] Fix Zustand selectors causing unnecessary re-renders #34

Closed
opened 2026-06-07 01:57:26 +00:00 by Mark · 0 comments
Owner

BOMPanel and CutListPanel subscribe to entire store.

  • BOMPanel.tsx:11 - const state = useStore() (no selector)
  • CutListPanel.tsx:10 - const state = useStore() (no selector)

Impact: O(parts) recalculation on EVERY state change. INP regression as assembly grows.

Fix: Use useShallow selector or pass assembly directly to memoized selector:
const bom = useStore(useShallow((s) => selectBOM(s)));

BOMPanel and CutListPanel subscribe to entire store. - BOMPanel.tsx:11 - const state = useStore() (no selector) - CutListPanel.tsx:10 - const state = useStore() (no selector) **Impact:** O(parts) recalculation on EVERY state change. INP regression as assembly grows. **Fix:** Use useShallow selector or pass assembly directly to memoized selector: const bom = useStore(useShallow((s) => selectBOM(s)));
Mark 2026-06-07 02:03:35 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Mark/parametric-furniture-cad#34
No description provided.