Skip to content

Commit ffc2aab

Browse files
fix: track viewportHeight via window.innerHeight to avoid unwanted scrolling
1 parent cacbfe5 commit ffc2aab

File tree

1 file changed

+20
-1
lines changed

1 file changed

+20
-1
lines changed

tools/server/webui/src/routes/+layout.svelte

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
import { ModeWatcher } from 'mode-watcher';
1818
import { Toaster } from 'svelte-sonner';
1919
import { goto } from '$app/navigation';
20+
import { onMount } from 'svelte';
2021
2122
let { children } = $props();
2223
@@ -25,6 +26,7 @@
2526
let isNewChatMode = $derived(page.url.searchParams.get('new_chat') === 'true');
2627
let showSidebarByDefault = $derived(activeMessages().length > 0 || isLoading());
2728
let sidebarOpen = $state(false);
29+
let viewportHeight = $state<number | undefined>();
2830
let chatSidebar:
2931
| { activateSearchMode?: () => void; editActiveConversation?: () => void }
3032
| undefined = $state();
@@ -61,6 +63,20 @@
6163
}
6264
}
6365
66+
function updateViewportHeight() {
67+
viewportHeight = window.innerHeight;
68+
}
69+
70+
onMount(() => {
71+
updateViewportHeight();
72+
73+
window.addEventListener('resize', updateViewportHeight);
74+
75+
return () => {
76+
window.removeEventListener('resize', updateViewportHeight);
77+
};
78+
});
79+
6480
function handleTitleUpdateCancel() {
6581
titleUpdateDialogOpen = false;
6682
if (titleUpdateResolve) {
@@ -155,7 +171,10 @@
155171
/>
156172

157173
<Sidebar.Provider bind:open={sidebarOpen}>
158-
<div class="flex h-screen w-full">
174+
<div
175+
class="flex h-screen w-full"
176+
style:height={viewportHeight !== undefined ? `${viewportHeight}px` : undefined}
177+
>
159178
<Sidebar.Root class="h-full">
160179
<ChatSidebar bind:this={chatSidebar} />
161180
</Sidebar.Root>

0 commit comments

Comments
 (0)