Tree panel mode lives in the root layout: no open-then-close on session open
The persisted mode (lh:tree-panel-mode) was read inside TreePanel — a per-page component that remounts on every session navigation. First paint rendered the SSR-safe "list" default, then the mount effect applied the stored mode: with the animated frame, opening a session visibly opened the panel and then closed it. The mode now lives in a root-layout provider (the SidebarProvider pattern) and survives navigations untouched — the panel mounts already in the right mode. The default stays "list" so SSR and first client render agree; the stored preference applies once, on provider mount.
This commit is contained in:
+4
-1
@@ -2,6 +2,7 @@ import type { Metadata } from "next";
|
||||
import "katex/dist/katex.min.css";
|
||||
import "./globals.css";
|
||||
import { AppShell, SidebarProvider } from "@/components/sidebar";
|
||||
import { TreePanelModeProvider } from "@/components/tree-panel";
|
||||
|
||||
export const metadata: Metadata = {
|
||||
title: "Learning Harness",
|
||||
@@ -13,7 +14,9 @@ export default function RootLayout({ children }: { children: React.ReactNode })
|
||||
<html lang="en" className="dark">
|
||||
<body className="min-h-dvh antialiased">
|
||||
<SidebarProvider>
|
||||
<AppShell>{children}</AppShell>
|
||||
<TreePanelModeProvider>
|
||||
<AppShell>{children}</AppShell>
|
||||
</TreePanelModeProvider>
|
||||
</SidebarProvider>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
Reference in New Issue
Block a user