Browse Source

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 <noreply@anthropic.com>
handoff-20260429-1057
shrimbly 4 months ago
parent
commit
942758de2a
  1. 2
      src/store/workflowStore.ts

2
src/store/workflowStore.ts

@ -526,7 +526,7 @@ const workflowStoreImpl: StateCreator<WorkflowStore> = (set, get) => ({
},
setHoveredNodeId: (id: string | null) => {
set({ hoveredNodeId: id });
if (get().hoveredNodeId !== id) set({ hoveredNodeId: id });
},
addNode: (type: NodeType, position: XYPosition, initialData?: Partial<WorkflowNodeData>) => {

Loading…
Cancel
Save