Skip to content

Open-source Grok Bot alternative for named AI teammates. Local-first desktop, web, and mobile clients with per-bot tools, instructions, and memory. Independent fork of T3 Code.

Preserve back navigation when opening settings (#5930)

Julius Marminge5da45337f717
diff --git a/apps/web/src/components/AppSidebarLayout.tsx b/apps/web/src/components/AppSidebarLayout.tsx
index 4888ded7d..d27cc0379 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 (
<SidebarProvider className="h-dvh! min-h-0!" defaultOpen style={sidebarProviderStyle}>
+ <ProjectProjectionRetention />
<Sidebar
side="left"
collapsible="offcanvas"