This commit is contained in:
Timothy Jaeryang Baek
2026-02-25 17:07:24 -06:00
parent 3271a5277c
commit f2c3fff278
2 changed files with 14 additions and 13 deletions
+10 -8
View File
@@ -141,11 +141,14 @@
dragged = false; dragged = false;
}; };
onMount(() => { onMount(async () => {
mediaQuery = window.matchMedia('(min-width: 1024px)'); mediaQuery = window.matchMedia('(min-width: 1024px)');
mediaQuery.addEventListener('change', handleMediaQuery); mediaQuery.addEventListener('change', handleMediaQuery);
handleMediaQuery(mediaQuery); handleMediaQuery(mediaQuery);
// Wait for Svelte to render the Pane after largeScreen changed
await tick();
const container = document.getElementById('chat-container'); const container = document.getElementById('chat-container');
minSize = Math.floor((350 / container.clientWidth) * 100); minSize = Math.floor((350 / container.clientWidth) * 100);
@@ -172,13 +175,12 @@
// Delay enabling onCollapse so the Pane's initial collapsed state // Delay enabling onCollapse so the Pane's initial collapsed state
// (defaultSize=0) doesn't reset showControls // (defaultSize=0) doesn't reset showControls
setTimeout(() => { setTimeout(() => { paneReady = true; }, 0);
paneReady = true;
// If controls were persisted as open, expand the pane now that it's ready // If controls were persisted as open, set the pane to the saved size
if ($showControls && pane) { if ($showControls && pane) {
openPane(); openPane();
} }
}, 0);
}); });
onDestroy(() => { onDestroy(() => {
+4 -5
View File
@@ -324,12 +324,11 @@
checkForVersionUpdates(); checkForVersionUpdates();
} }
} }
// Persist showControls via chatControlsSize (0 = closed, >0 = open at that size) // Persist showControls: track open/close state separately from saved size
await showControls.set(!$mobile ? parseInt(localStorage.chatControlsSize || '0') > 0 : false); // chatControlsSize always retains the last width for openPane()
await showControls.set(!$mobile ? localStorage.showControls === 'true' : false);
showControls.subscribe((value) => { showControls.subscribe((value) => {
if (!value) { localStorage.showControls = value ? 'true' : 'false';
localStorage.chatControlsSize = '0';
}
}); });
await tick(); await tick();