Browse Source

Check e.buttons to block hover events during any mouse-down drag

The isDraggingNodeRef check had a race condition: fast mouse movement
could trigger onMouseEnter before React Flow's onNodeDragStart fired.
Adding e.buttons !== 0 catches all cases where a button is held,
which is always true during drag, with no timing dependency.

https://claude.ai/code/session_01MvD1n4QeXutgwUpKJuDGHa
handoff-20260429-1057
Claude 4 months ago
parent
commit
ce0bbb3dc9
Failed to extract signature
  1. 8
      src/components/nodes/BaseNode.tsx

8
src/components/nodes/BaseNode.tsx

@ -296,12 +296,12 @@ export function BaseNode({
${!fullBleed && selected && settingsExpanded ? "border-blue-500" : ""} ${!fullBleed && selected && settingsExpanded ? "border-blue-500" : ""}
${className} ${className}
`} `}
onMouseEnter={() => { onMouseEnter={(e) => {
if (isPanningRef.current || isDraggingNodeRef.current) return; if (e.buttons !== 0 || isPanningRef.current || isDraggingNodeRef.current) return;
setHoveredNodeId(id); setHoveredNodeId(id);
}} }}
onMouseLeave={() => { onMouseLeave={(e) => {
if (isPanningRef.current || isDraggingNodeRef.current) return; if (e.buttons !== 0 || isPanningRef.current || isDraggingNodeRef.current) return;
setHoveredNodeId(null); setHoveredNodeId(null);
}} }}
> >

Loading…
Cancel
Save