perf(frontend): uiStore writes re-render whole-store subscribers and hit localStorage per pointermove #725
Labels
No labels
backend
bug
chore
duplication
effort:complex
effort:medium
effort:trivial
enhancement
follow-up
frontend
fullstack
priority:high
ready-for-agent
refactor
security
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
dries/ocman#725
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Follow-up from the perf report (second tier).
Symptom: `components/Resizer.tsx:58-64` calls `setWidth` per `pointermove` → `uiStore.ts:255` `set()` → the `persist` middleware serialises the `partialize` object (`uiStore.ts:444-468`) to localStorage per move. `App.tsx:133-137` (`GlobalHotkeys`) and `components/CommandPalette.tsx:164-171` subscribe with a bare `useUiStore()` (no selector), so both re-render per pixel, dragging `CommandPalette` (896 lines) along. Same pattern in `RightPanel.tsx:685-696`. `components/TerminalPane.tsx:160-167` then runs `fit.fit()` + a WS resize per observed frame during the drag (SIGWINCH storm on the PTY).
Fix: per-field selectors for the two bare `useUiStore()` calls; keep a local width during drag in `Resizer` and commit on pointerup; rAF/50 ms trailing debounce in the terminal ResizeObserver.