fix: remove Set-based Zustand selectors causing infinite re-render loop

Zustand selectors returning new Set() on every call fail Object.is
equality check, triggering continuous re-renders. Replaced with
useMemo-derived Sets in consuming components.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Michael Chihlas
2026-02-20 21:32:13 -05:00
parent 0b6d5727c9
commit a29f3474a5
3 changed files with 18 additions and 17 deletions

View File

@@ -102,12 +102,3 @@ export const usePinnedFlowsStore = create<PinnedFlowsState>()((set, get) => ({
},
}))
export const selectPinnedTreeIds = (state: PinnedFlowsState): Set<string> =>
new Set(state.items.map((f) => f.tree_id))
export const selectPinLoadingTreeIds = (state: PinnedFlowsState): Set<string> =>
new Set(
Object.entries(state.isMutatingByTreeId)
.filter(([, v]) => v)
.map(([k]) => k)
)