authorgravatar for 118054752+extoci@users.noreply.github.comExotic <118054752+extoci@users.noreply.github.com> 2026-08-12 17:07:39+03:00
committergravatar for noreply@github.comGitHub <noreply@github.com> 2026-08-12 10:07:39-04:00
logb73232bdd31e83914a8a943960c7dc4b6390b39b
tree0ebeaccf4de2e2a9bd16fdb6fcb95a1690f9924c
parentf131228a5908974c90d9b80a4d8ef866bb29e973
signature Signed by PGP key B5690EEEBB952194

feat(web): reset sidebar width on double click (#6320)


1 files changed, 10 insertions(+), 2 deletions(-)

apps/web/src/components/AppSidebarLayout.tsx+10-2
......@@ -10,7 +10,7 @@ import {
1010import { useLocation, useNavigate } from "@tanstack/react-router";
1111
1212import { isElectron } from "../env";
13import { getLocalStorageItem } from "../hooks/useLocalStorage";
13import { getLocalStorageItem, removeLocalStorageItem } from "../hooks/useLocalStorage";
1414import { resolveShortcutCommand, shortcutLabelForCommand } from "../keybindings";
1515import { cn, isMacPlatform } from "../lib/utils";
1616import { primaryServerKeybindingsAtom } from "../state/server";
......@@ -147,6 +147,14 @@ export function AppSidebarLayout({ children }: { children: ReactNode }) {
147147 // that would otherwise refresh a render-time snapshot.
148148 const viewportWidth = useSyncExternalStore(subscribeToViewportWidth, readViewportWidth);
149149 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 };
150158 const [isWindowFullscreen, setIsWindowFullscreen] = useState(() => {
151159 const getWindowFullscreenState = window.desktopBridge?.getWindowFullscreenState;
152160 return isMacosDesktop && typeof getWindowFullscreenState === "function"
......@@ -225,7 +233,7 @@ export function AppSidebarLayout({ children }: { children: ReactNode }) {
225233 ) : (
226234 <ThreadSidebar />
227235 )}
228 <SidebarRail />
236 <SidebarRail onDoubleClick={resetSidebarWidth} />
229237 </Sidebar>
230238 {children}
231239 <SidebarControl />