| ... | @@ -10,7 +10,7 @@ import { | ... | @@ -10,7 +10,7 @@ import { |
| 10 | import { useLocation, useNavigate } from "@tanstack/react-router"; | 10 | import { useLocation, useNavigate } from "@tanstack/react-router"; |
| 11 | | 11 | |
| 12 | import { isElectron } from "../env"; | 12 | import { isElectron } from "../env"; |
| 13 | import { getLocalStorageItem } from "../hooks/useLocalStorage"; | 13 | import { getLocalStorageItem, removeLocalStorageItem } from "../hooks/useLocalStorage"; |
| 14 | import { resolveShortcutCommand, shortcutLabelForCommand } from "../keybindings"; | 14 | import { resolveShortcutCommand, shortcutLabelForCommand } from "../keybindings"; |
| 15 | import { cn, isMacPlatform } from "../lib/utils"; | 15 | import { cn, isMacPlatform } from "../lib/utils"; |
| 16 | import { primaryServerKeybindingsAtom } from "../state/server"; | 16 | import { primaryServerKeybindingsAtom } from "../state/server"; |
| ... | @@ -147,6 +147,14 @@ export function AppSidebarLayout({ children }: { children: ReactNode }) { | ... | @@ -147,6 +147,14 @@ export function AppSidebarLayout({ children }: { children: ReactNode }) { |
| 147 | // that would otherwise refresh a render-time snapshot. | 147 | // that would otherwise refresh a render-time snapshot. |
| 148 | const viewportWidth = useSyncExternalStore(subscribeToViewportWidth, readViewportWidth); | 148 | const viewportWidth = useSyncExternalStore(subscribeToViewportWidth, readViewportWidth); |
| 149 | const sidebarMaximumWidth = resolveThreadSidebarMaximumWidth(viewportWidth); | 149 | const sidebarMaximumWidth = resolveThreadSidebarMaximumWidth(viewportWidth); |
| | 150 | const resetSidebarWidth = () => { |
| | 151 | try { |
| | 152 | removeLocalStorageItem(THREAD_SIDEBAR_WIDTH_STORAGE_KEY); |
| | 153 | } catch (error) { |
| | 154 | console.error("Could not clear persisted thread sidebar width.", error); |
| | 155 | } |
| | 156 | setSidebarWidth(resolveInitialThreadSidebarWidth(null, viewportWidth)); |
| | 157 | }; |
| 150 | const [isWindowFullscreen, setIsWindowFullscreen] = useState(() => { | 158 | const [isWindowFullscreen, setIsWindowFullscreen] = useState(() => { |
| 151 | const getWindowFullscreenState = window.desktopBridge?.getWindowFullscreenState; | 159 | const getWindowFullscreenState = window.desktopBridge?.getWindowFullscreenState; |
| 152 | return isMacosDesktop && typeof getWindowFullscreenState === "function" | 160 | return isMacosDesktop && typeof getWindowFullscreenState === "function" |
| ... | @@ -225,7 +233,7 @@ export function AppSidebarLayout({ children }: { children: ReactNode }) { | ... | @@ -225,7 +233,7 @@ export function AppSidebarLayout({ children }: { children: ReactNode }) { |
| 225 | ) : ( | 233 | ) : ( |
| 226 | <ThreadSidebar /> | 234 | <ThreadSidebar /> |
| 227 | )} | 235 | )} |
| 228 | <SidebarRail /> | 236 | <SidebarRail onDoubleClick={resetSidebarWidth} /> |
| 229 | </Sidebar> | 237 | </Sidebar> |
| 230 | {children} | 238 | {children} |
| 231 | <SidebarControl /> | 239 | <SidebarControl /> |