From e20f99a13b747a6a6ac6c14bbc00e91f5cc65843 Mon Sep 17 00:00:00 2001 From: shrimbly Date: Tue, 10 Mar 2026 12:47:09 +1300 Subject: [PATCH] fix: reset node height on paste to prevent compounding growth When pasting nodes with inline parameters expanded, the copied style.height (which included settings panel contribution) was preserved, causing BaseNode's ResizeObserver to add panel height again on top of the already-inflated height. Now pasteNodes() resets height to type defaults while preserving user-set width. Co-Authored-By: Claude Opus 4.6 --- src/store/workflowStore.ts | 29 +++++++++++++++++++---------- 1 file changed, 19 insertions(+), 10 deletions(-) diff --git a/src/store/workflowStore.ts b/src/store/workflowStore.ts index 6c8a15fc..731ef35b 100644 --- a/src/store/workflowStore.ts +++ b/src/store/workflowStore.ts @@ -728,16 +728,25 @@ const workflowStoreImpl: StateCreator = (set, get) => ({ }); // Create new nodes with updated IDs and offset positions - const newNodes: WorkflowNode[] = clipboard.nodes.map((node) => ({ - ...node, - id: idMapping.get(node.id)!, - position: { - x: node.position.x + offset.x, - y: node.position.y + offset.y, - }, - selected: true, // Select newly pasted nodes - data: JSON.parse(JSON.stringify(node.data)), - })); + const newNodes: WorkflowNode[] = clipboard.nodes.map((node) => { + const defaults = defaultNodeDimensions[node.type as NodeType] || { width: 300, height: 280 }; + return { + ...node, + id: idMapping.get(node.id)!, + position: { + x: node.position.x + offset.x, + y: node.position.y + offset.y, + }, + selected: true, // Select newly pasted nodes + // Reset height to defaults so BaseNode's ResizeObserver + // can correctly add settings panel height from the right baseline + style: { width: node.style?.width ?? defaults.width, height: defaults.height }, + width: undefined, + height: undefined, + measured: undefined, + data: JSON.parse(JSON.stringify(node.data)), + }; + }); // Create new edges with updated source/target IDs const newEdges: WorkflowEdge[] = clipboard.edges.map((edge) => ({