Skip to content

Commit ec038c7

Browse files
committed
fix node content resize reset
1 parent 92f456f commit ec038c7

1 file changed

Lines changed: 3 additions & 7 deletions

File tree

src/extensions/react-flow/nodes/NodeContent.tsx

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -395,26 +395,22 @@ export function NodeContent<CONTENT_PROPS = any>({
395395
}
396396

397397
React.useEffect(() => {
398-
if(nodeContentRef.current && !(originalSize.current.width || originalSize.current.height)) {
398+
if(nodeContentRef.current && (!(originalSize.current.width || originalSize.current.height) || !(width || height))) {
399399
saveOriginalSize();
400400
}
401-
}, [!!nodeContentRef.current, !(originalSize.current.width || originalSize.current.height)])
401+
}, [!!nodeContentRef.current, !(originalSize.current.width || originalSize.current.height), !(width || height)])
402402

403403
// Update width and height when node dimensions parameters has changed
404404
React.useEffect(() => {
405405
const updateWidth = nodeDimensions?.width ? validateWidth(nodeDimensions?.width) : undefined;
406406
const updateHeight = nodeDimensions?.height ? validateHeight(nodeDimensions?.height) : undefined;
407407
setWidth(updateWidth);
408408
setHeight(updateHeight);
409-
if (!nodeDimensions?.width && !nodeDimensions?.height) {
410-
// provoke new measuring if no dimensions are set
411-
saveOriginalSize();
412-
}
413409
}, [nodeDimensions]);
414410

415411
const isResizingActive = React.useCallback((): boolean => {
416412
const currentClassNames = nodeContentRef.current.classList;
417-
return resizeDirections.right === currentClassNames.contains("is-resizable-horizontal") &&
413+
return resizeDirections.right === currentClassNames.contains("is-resizable-horizontal") ||
418414
resizeDirections.bottom === currentClassNames.contains("is-resizable-vertical");
419415
}, [])
420416

0 commit comments

Comments
 (0)