Skip to content

Commit 68723a6

Browse files
committed
fix(ResizablePanel): infinite loop in controllable mode * 3
1 parent 1c8ba6e commit 68723a6

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

src/components/layout/ResizablePanel.tsx

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -268,12 +268,16 @@ function ResizablePanel(
268268
});
269269

270270
useEffect(() => {
271-
if (providedSize == null || Math.abs(providedSize - size) > 0.5) {
271+
if (
272+
(providedSize == null || Math.abs(providedSize - size) > 0.5) &&
273+
visualSize != null &&
274+
!isDragging
275+
) {
272276
setTimeout(() => {
273-
onSizeChange?.(Math.round(size));
277+
onSizeChange?.(Math.round(visualSize));
274278
});
275279
}
276-
}, [size]);
280+
}, [visualSize]);
277281

278282
useEffect(() => {
279283
if (providedSize && Math.abs(providedSize - size) > 0.5) {

0 commit comments

Comments
 (0)