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" : ""}
${className}
`}
onMouseEnter={() => {
if (isPanningRef.current || isDraggingNodeRef.current) return;
onMouseEnter={(e) => {
if (e.buttons !== 0 || isPanningRef.current || isDraggingNodeRef.current) return;
setHoveredNodeId(id);
}}
onMouseLeave={() => {
if (isPanningRef.current || isDraggingNodeRef.current) return;
onMouseLeave={(e) => {
if (e.buttons !== 0 || isPanningRef.current || isDraggingNodeRef.current) return;
setHoveredNodeId(null);
}}
>

Loading…
Cancel
Save