Skip to content

Commit 5da4533

Browse files
Preserve back navigation when opening settings (#5930)
Co-authored-by: codex <codex@users.noreply.github.com>
1 parent f21d5e4 commit 5da4533

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

apps/web/src/components/AppSidebarLayout.tsx

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ import ThreadSidebar from "./Sidebar";
2020
import { SettingsSidebarNav } from "./settings/SettingsSidebarNav";
2121
import { SidebarChromeHeader } from "./sidebar/SidebarChrome";
2222
import { useSidebarStageBackdropVariant } from "./SidebarStageBackdrop";
23+
import { useProjects } from "../state/entities";
2324
import {
2425
resolveInitialThreadSidebarWidth,
2526
resolveThreadSidebarMaximumWidth,
@@ -118,6 +119,14 @@ function SidebarControl() {
118119
);
119120
}
120121

122+
// Settings swaps the thread sidebar out of the tree. Keep the lightweight
123+
// project projection subscribed so returning to a draft never renders the
124+
// zero-project state while the environment snapshot reconnects.
125+
function ProjectProjectionRetention() {
126+
useProjects();
127+
return null;
128+
}
129+
121130
export function AppSidebarLayout({ children }: { children: ReactNode }) {
122131
const navigate = useNavigate();
123132
const legacySidebarEnabled = useLegacySidebarEnabled();
@@ -184,6 +193,7 @@ export function AppSidebarLayout({ children }: { children: ReactNode }) {
184193

185194
return (
186195
<SidebarProvider className="h-dvh! min-h-0!" defaultOpen style={sidebarProviderStyle}>
196+
<ProjectProjectionRetention />
187197
<Sidebar
188198
side="left"
189199
collapsible="offcanvas"

0 commit comments

Comments
 (0)