Browse Source

fix: FloatingNodeHeader width prefers measured over stale style value

The header width calculation was preferring node.style.width (set at
creation time, often stale) over node.measured.width (actual DOM size).
This caused headers to be narrower than nodes after image generation
or manual resizing. Now uses measured → style → default fallback chain,
matching the existing pattern used elsewhere in the file.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
handoff-20260429-1057
shrimbly 4 months ago
parent
commit
d12e293d59
  1. 8
      src/components/WorkflowCanvas.tsx

8
src/components/WorkflowCanvas.tsx

@ -2060,14 +2060,8 @@ export function WorkflowCanvas() {
// Groups don't get floating headers
if (node.type === "group") return null;
const styleW = node.style?.width;
const nodeWidth =
typeof styleW === "number" ? styleW
: typeof styleW === "string" ? parseFloat(styleW) || 0
: 0;
const measuredWidth = (node.measured?.width) || 0;
const defaultWidth = defaultNodeDimensions[node.type as NodeType]?.width ?? 250;
const headerWidth = nodeWidth || measuredWidth || defaultWidth;
const headerWidth = node.measured?.width || (node.style?.width as number) || defaultWidth;
return (
<FloatingNodeHeader

Loading…
Cancel
Save