From d2e91c2713c352940da6d7508806c585f29477b2 Mon Sep 17 00:00:00 2001 From: Waleed Latif Date: Mon, 5 May 2025 01:23:10 -0700 Subject: [PATCH] improvement(performance): modify the long-input resize behavior to maintain the same behavior but only update the state once the resize is complete --- .../components/sub-block/components/long-input.tsx | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/sim/app/w/[id]/components/workflow-block/components/sub-block/components/long-input.tsx b/sim/app/w/[id]/components/workflow-block/components/sub-block/components/long-input.tsx index 204620a3f9..a1fb582507 100644 --- a/sim/app/w/[id]/components/workflow-block/components/sub-block/components/long-input.tsx +++ b/sim/app/w/[id]/components/workflow-block/components/sub-block/components/long-input.tsx @@ -116,15 +116,21 @@ export function LongInput({ const deltaY = moveEvent.clientY - startY const newHeight = Math.max(MIN_HEIGHT_PX, startHeight + deltaY) - setHeight(newHeight) - if (textareaRef.current && overlayRef.current) { textareaRef.current.style.height = `${newHeight}px` overlayRef.current.style.height = `${newHeight}px` + if (containerRef.current) { + containerRef.current.style.height = `${newHeight}px` + } } } const handleMouseUp = () => { + if (textareaRef.current) { + const finalHeight = parseInt(textareaRef.current.style.height, 10) || height + setHeight(finalHeight) + } + isResizing.current = false document.removeEventListener('mousemove', handleMouseMove) document.removeEventListener('mouseup', handleMouseUp)