From 5da45337f7178db711624c3e7c4d69059b2b286a Mon Sep 17 00:00:00 2001 From: Julius Marminge Date: Mon, 10 Aug 2026 03:55:32 +0200 Subject: [PATCH] Preserve back navigation when opening settings (#5930) Co-authored-by: codex --- apps/web/src/components/AppSidebarLayout.tsx | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/apps/web/src/components/AppSidebarLayout.tsx b/apps/web/src/components/AppSidebarLayout.tsx index 4888ded7d0f4d8a8163304db95225aaf7e83c205..d27cc0379d729fa87b9954b62cb803df148c3346 100644 --- a/apps/web/src/components/AppSidebarLayout.tsx +++ b/apps/web/src/components/AppSidebarLayout.tsx @@ -20,6 +20,7 @@ import ThreadSidebar from "./Sidebar"; import { SettingsSidebarNav } from "./settings/SettingsSidebarNav"; import { SidebarChromeHeader } from "./sidebar/SidebarChrome"; import { useSidebarStageBackdropVariant } from "./SidebarStageBackdrop"; +import { useProjects } from "../state/entities"; import { resolveInitialThreadSidebarWidth, resolveThreadSidebarMaximumWidth, @@ -118,6 +119,14 @@ function SidebarControl() { ); } +// Settings swaps the thread sidebar out of the tree. Keep the lightweight +// project projection subscribed so returning to a draft never renders the +// zero-project state while the environment snapshot reconnects. +function ProjectProjectionRetention() { + useProjects(); + return null; +} + export function AppSidebarLayout({ children }: { children: ReactNode }) { const navigate = useNavigate(); const legacySidebarEnabled = useLegacySidebarEnabled(); @@ -184,6 +193,7 @@ export function AppSidebarLayout({ children }: { children: ReactNode }) { return ( +