Skip to content

Commit 9b08b52

Browse files
authored
FIX: Initial split size was not obeyed (#910)
1 parent cab81e6 commit 9b08b52

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

packages/frontend/src/page/document_page.tsx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,9 @@ type AnyLiveDocWithRef = {
5151
docRef: DocRef;
5252
};
5353

54+
// The initial size of the right panel in a split as a percentage of the total available width
55+
const INITIAL_SPLIT_SIZE = 0.33;
56+
5457
export default function DocumentPage() {
5558
const api = useApi();
5659
const models = useContext(ModelLibraryContext);
@@ -108,10 +111,12 @@ export default function DocumentPage() {
108111
createEffect(() => {
109112
const context = resizableContext();
110113
if (isSidePanelOpen()) {
114+
// expand the second panel
111115
context?.expand(1);
112-
context?.resize(1, 0.33);
113116
} else {
117+
// collapse the second panel
114118
context?.collapse(1);
119+
// Set the first panel to be the full size
115120
context?.resize(0, 1);
116121
}
117122
});
@@ -172,6 +177,7 @@ export default function DocumentPage() {
172177
<ResizableHandle class="resizeable-handle" />
173178
<Resizable.Panel
174179
class="content-panel"
180+
initialSize={INITIAL_SPLIT_SIZE}
175181
minSize={0.25}
176182
onCollapse={closeSidePanel}
177183
>

0 commit comments

Comments
 (0)