Skip to content

Commit 8057d14

Browse files
committed
fix(ResizablePanel): round the size prop
1 parent b6ea1f6 commit 8057d14

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/components/layout/ResizablePanel.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -200,8 +200,8 @@ function ResizablePanel(
200200

201201
const offsetProp = isHorizontal ? 'offsetWidth' : 'offsetHeight';
202202

203-
if (ref.current && Math.abs(ref.current[offsetProp] - size) > 1) {
204-
setSize(ref.current[offsetProp]);
203+
if (ref.current && Math.abs(ref.current[offsetProp] - size) >= 1) {
204+
setSize(Math.round(ref.current[offsetProp]));
205205
}
206206
},
207207
onMove(e) {
@@ -229,7 +229,7 @@ function ResizablePanel(
229229

230230
useEffect(() => {
231231
if (providedSize == null || Math.abs(providedSize - size) > 0.5) {
232-
onSizeChange?.(size);
232+
onSizeChange?.(Math.round(size));
233233
}
234234
}, [size]);
235235

0 commit comments

Comments
 (0)