From 20b8b999388ca8e162d16a1823b018ef8eb4019d Mon Sep 17 00:00:00 2001 From: suryo12 Date: Mon, 25 May 2026 22:06:44 +0700 Subject: [PATCH] refactor(web): shrink LayoutShell.documentsPanel interface (fixes #1360) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The `documentsPanel` prop on `LayoutShell` declared `isDocked` and `onDockedChange` alongside `open` / `onOpenChange`, but the shell never forwarded those two extra fields to its consumers. `RightPanel` already defines its own interface accepting only `open` / `onOpenChange`, and `DocumentsSidebar` keeps both as optional props with safe fallbacks for the rare cases that pass them directly. Trim the interface to the two fields the shell actually plumbs through and drop the matching `isDocumentsDocked` state and prop entries from `LayoutDataProvider`, which was the only caller still populating the dead fields (`FreeLayoutDataProvider` already passed the minimal pair). `DocumentsSidebar` itself is untouched — its props remain optional so direct consumers that want docking behaviour can still wire it. --- .../components/layout/providers/LayoutDataProvider.tsx | 3 --- surfsense_web/components/layout/ui/shell/LayoutShell.tsx | 2 -- 2 files changed, 5 deletions(-) diff --git a/surfsense_web/components/layout/providers/LayoutDataProvider.tsx b/surfsense_web/components/layout/providers/LayoutDataProvider.tsx index 917d1c6e1..73b81d439 100644 --- a/surfsense_web/components/layout/providers/LayoutDataProvider.tsx +++ b/surfsense_web/components/layout/providers/LayoutDataProvider.tsx @@ -127,7 +127,6 @@ export function LayoutDataProvider({ searchSpaceId, children }: LayoutDataProvid // Documents sidebar state (shared atom so Composer can toggle it) const [isDocumentsSidebarOpen, setIsDocumentsSidebarOpen] = useAtom(documentsSidebarOpenAtom); - const [isDocumentsDocked, setIsDocumentsDocked] = useState(true); const setIsRightPanelCollapsed = useSetAtom(rightPanelCollapsedAtom); // Open documents sidebar by default on desktop (docked mode) @@ -748,8 +747,6 @@ export function LayoutDataProvider({ searchSpaceId, children }: LayoutDataProvid documentsPanel={{ open: isDocumentsSidebarOpen, onOpenChange: setIsDocumentsSidebarOpen, - isDocked: isDocumentsDocked, - onDockedChange: setIsDocumentsDocked, }} onTabSwitch={handleTabSwitch} > diff --git a/surfsense_web/components/layout/ui/shell/LayoutShell.tsx b/surfsense_web/components/layout/ui/shell/LayoutShell.tsx index 2f799929b..91d85cc1e 100644 --- a/surfsense_web/components/layout/ui/shell/LayoutShell.tsx +++ b/surfsense_web/components/layout/ui/shell/LayoutShell.tsx @@ -157,8 +157,6 @@ interface LayoutShellProps { documentsPanel?: { open: boolean; onOpenChange: (open: boolean) => void; - isDocked?: boolean; - onDockedChange?: (docked: boolean) => void; }; onTabSwitch?: (tab: Tab) => void; }