From 942758de2a1051c327a41d043d77fc54578c553f Mon Sep 17 00:00:00 2001 From: shrimbly Date: Tue, 10 Mar 2026 22:04:05 +1300 Subject: [PATCH] perf: guard setHoveredNodeId against redundant store mutations Skip Zustand set() when hoveredNodeId already matches the incoming value. Prevents redundant store updates when the mouse stays on the same node or when onMouseLeave fires with null when already null. Co-Authored-By: Claude Opus 4.6 --- src/store/workflowStore.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/store/workflowStore.ts b/src/store/workflowStore.ts index 472206ab..49632a4e 100644 --- a/src/store/workflowStore.ts +++ b/src/store/workflowStore.ts @@ -526,7 +526,7 @@ const workflowStoreImpl: StateCreator = (set, get) => ({ }, setHoveredNodeId: (id: string | null) => { - set({ hoveredNodeId: id }); + if (get().hoveredNodeId !== id) set({ hoveredNodeId: id }); }, addNode: (type: NodeType, position: XYPosition, initialData?: Partial) => {