diff --git a/surfsense_web/app/dashboard/[search_space_id]/new-chat/[[...chat_id]]/page.tsx b/surfsense_web/app/dashboard/[search_space_id]/new-chat/[[...chat_id]]/page.tsx index 0f0eaed96..8e877b99c 100644 --- a/surfsense_web/app/dashboard/[search_space_id]/new-chat/[[...chat_id]]/page.tsx +++ b/surfsense_web/app/dashboard/[search_space_id]/new-chat/[[...chat_id]]/page.tsx @@ -276,7 +276,7 @@ export default function NewChatPage() { const initializeThread = useCallback(async () => { setIsInitializing(true); - // Reset all state when switching between chats to prevent stale data + // Reset all state when switching between chats/search spaces to prevent stale data setMessages([]); setThreadId(null); setCurrentThread(null); @@ -284,8 +284,8 @@ export default function NewChatPage() { setMentionedDocuments([]); setSidebarDocuments([]); setMessageDocumentsMap({}); - clearPlanOwnerRegistry(); // Reset plan ownership for new chat - closeReportPanel(); // Close report panel when switching chats + clearPlanOwnerRegistry(); + closeReportPanel(); try { if (urlChatId > 0) { @@ -346,6 +346,7 @@ export default function NewChatPage() { } }, [ urlChatId, + searchSpaceId, setMessageDocumentsMap, setMentionedDocuments, setSidebarDocuments, @@ -1671,7 +1672,7 @@ export default function NewChatPage() { {/* Disabled for now */} -
+
diff --git a/surfsense_web/components/assistant-ui/thread.tsx b/surfsense_web/components/assistant-ui/thread.tsx index 38426a47b..94a3618e9 100644 --- a/surfsense_web/components/assistant-ui/thread.tsx +++ b/surfsense_web/components/assistant-ui/thread.tsx @@ -220,14 +220,14 @@ const ThreadWelcome: FC = () => { return (
- {/* Greeting positioned above the composer - fixed position */} + {/* Greeting positioned above the composer */}
-

+

{greeting}

{/* Composer - top edge fixed, expands downward only */} -
+
diff --git a/surfsense_web/components/layout/providers/LayoutDataProvider.tsx b/surfsense_web/components/layout/providers/LayoutDataProvider.tsx index 4e167b2e4..3de1b7ac5 100644 --- a/surfsense_web/components/layout/providers/LayoutDataProvider.tsx +++ b/surfsense_web/components/layout/providers/LayoutDataProvider.tsx @@ -262,6 +262,15 @@ export function LayoutDataProvider({ searchSpaceId, children }: LayoutDataProvid } }, [pendingNewChat, params?.chat_id, router, searchSpaceId, resetCurrentThread]); + // Reset transient slide-out panels when switching search spaces. + // Some browsers can retain overlay/backdrop state across route transitions. + useEffect(() => { + setIsInboxSidebarOpen(false); + setIsAllSharedChatsSidebarOpen(false); + setIsAllPrivateChatsSidebarOpen(false); + setIsAnnouncementsSidebarOpen(false); + }, [searchSpaceId]); + const searchSpaces: SearchSpace[] = useMemo(() => { if (!searchSpacesData || !Array.isArray(searchSpacesData)) return []; return searchSpacesData.map((space) => ({ diff --git a/surfsense_web/components/layout/ui/right-panel/RightPanel.tsx b/surfsense_web/components/layout/ui/right-panel/RightPanel.tsx index 0c812d88f..1e48f6f74 100644 --- a/surfsense_web/components/layout/ui/right-panel/RightPanel.tsx +++ b/surfsense_web/components/layout/ui/right-panel/RightPanel.tsx @@ -2,7 +2,6 @@ import { useAtom, useAtomValue, useSetAtom } from "jotai"; import { PanelRight, PanelRightClose } from "lucide-react"; -import { AnimatePresence, motion } from "motion/react"; import { startTransition, useEffect } from "react"; import { closeReportPanelAtom, reportPanelAtom } from "@/atoms/chat/report-panel.atom"; import { documentsSidebarOpenAtom } from "@/atoms/documents/ui.atoms"; @@ -99,70 +98,35 @@ export function RightPanel({ documentsPanel }: RightPanelProps) { const targetWidth = PANEL_WIDTHS[effectiveTab]; const collapseButton = setCollapsed(true)} />; - const contentKey = - effectiveTab === "sources" && documentsOpen - ? "sources" - : effectiveTab === "report" && reportOpen - ? "report" - : null; + if (!isVisible) return null; return ( - - {isVisible && ( - -
- - {contentKey === "sources" && documentsPanel && ( - - - - )} - {contentKey === "report" && ( - -
- -
-
- )} -
+ ); } diff --git a/surfsense_web/components/layout/ui/shell/LayoutShell.tsx b/surfsense_web/components/layout/ui/shell/LayoutShell.tsx index ab2945f61..f03283192 100644 --- a/surfsense_web/components/layout/ui/shell/LayoutShell.tsx +++ b/surfsense_web/components/layout/ui/shell/LayoutShell.tsx @@ -1,6 +1,5 @@ "use client"; -import { motion } from "motion/react"; import { useMemo, useState } from "react"; import { TooltipProvider } from "@/components/ui/tooltip"; import type { InboxItem } from "@/hooks/use-inbox"; @@ -308,27 +307,23 @@ export function LayoutShell({ isResizing={isResizing} /> - +
{children}
- +
- {/* Right panel — tabbed Sources/Report (desktop only) */} - {documentsPanel && ( - - )} + {/* Right panel — tabbed Sources/Report (desktop only) */} + {documentsPanel && ( + + )} {/* Inbox Sidebar - slide-out panel */} {inbox && (