We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 2adfe7f commit 4f8977aCopy full SHA for 4f8977a
src/react-utils/useNodeResizing.ts
@@ -83,9 +83,16 @@ export const useNodeResizing = ({
83
setCurrentWidth(newWidth);
84
setCurrentHeight(newHeight);
85
86
+ // If neither width nor height are provided, the width is set automatically.
87
+ const shouldSetWidth =
88
+ !initialWidth &&
89
+ initialWidth !== 0 &&
90
+ !(initialWidth === null && initialHeight === null);
91
+ const shouldSetHeight = !initialHeight && initialHeight !== 0;
92
+
93
onResize?.({
- width: !initialWidth && initialWidth !== 0 ? undefined : newWidth,
- height: !initialHeight && initialHeight !== 0 ? undefined : newHeight,
94
+ width: shouldSetWidth ? undefined : newWidth,
95
+ height: shouldSetHeight ? undefined : newHeight,
96
});
97
}
98
0 commit comments