Skip to content
This repository was archived by the owner on Jun 24, 2025. It is now read-only.

Commit bd4ebd3

Browse files
committed
To avoid the left pane from sometimes being resized to a very small width.
1 parent a76ca76 commit bd4ebd3

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

apps/client/src/services/resizer.ts

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,16 @@ function setupLeftPaneResizer(leftPaneVisible: boolean) {
2626
}
2727

2828
if (leftPaneVisible) {
29-
leftInstance = Split(["#left-pane", "#rest-pane"], {
30-
sizes: [leftPaneWidth, 100 - leftPaneWidth],
31-
gutterSize: DEFAULT_GUTTER_SIZE,
32-
onDragEnd: (sizes) => options.save("leftPaneWidth", Math.round(sizes[0]))
29+
// Delayed initialization ensures that all DOM elements are fully rendered and part of the layout,
30+
// preventing Split.js from retrieving incorrect dimensions due to #left-pane not being rendered yet,
31+
// which would cause the minSize setting to have no effect.
32+
requestAnimationFrame(() => {
33+
leftInstance = Split(["#left-pane", "#rest-pane"], {
34+
sizes: [leftPaneWidth, 100 - leftPaneWidth],
35+
gutterSize: DEFAULT_GUTTER_SIZE,
36+
minSize: [150, 300],
37+
onDragEnd: (sizes) => options.save("leftPaneWidth", Math.round(sizes[0]))
38+
});
3339
});
3440
}
3541
}

0 commit comments

Comments
 (0)