From cfc3be5b1fcc19d7e857c23ec21ad3337ec226a0 Mon Sep 17 00:00:00 2001 From: CREDO23 Date: Fri, 19 Jun 2026 19:22:19 +0200 Subject: [PATCH] fix: gate desktop right panel to prevent duplicate mobile editor --- .../components/layout/ui/right-panel/RightPanel.tsx | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/surfsense_web/components/layout/ui/right-panel/RightPanel.tsx b/surfsense_web/components/layout/ui/right-panel/RightPanel.tsx index bfad44dd8..6662d7830 100644 --- a/surfsense_web/components/layout/ui/right-panel/RightPanel.tsx +++ b/surfsense_web/components/layout/ui/right-panel/RightPanel.tsx @@ -12,6 +12,7 @@ import { rightPanelCollapsedAtom, rightPanelTabAtom } from "@/atoms/layout/right import { Button } from "@/components/ui/button"; import { Tooltip, TooltipContent, TooltipTrigger } from "@/components/ui/tooltip"; import { closeHitlEditPanelAtom, hitlEditPanelAtom } from "@/features/chat-messages/hitl"; +import { useMediaQuery } from "@/hooks/use-media-query"; import { cn } from "@/lib/utils"; import { DocumentsSidebar } from "../sidebar"; @@ -196,6 +197,9 @@ export function RightPanel({ const citationState = useAtomValue(citationPanelAtom); const closeCitation = useSetAtom(closeCitationPanelAtom); const [collapsed, setCollapsed] = useAtom(rightPanelCollapsedAtom); + // Desktop-only surface; mobile uses the dedicated Mobile* drawers. Without + // this guard both render together and two editors fight over one model. + const isDesktop = useMediaQuery("(min-width: 1024px)"); const documentsOpen = documentsPanel?.open ?? false; const reportOpen = reportState.isOpen && !!reportState.reportId; @@ -267,7 +271,7 @@ export function RightPanel({ setCollapsed(true)} /> ) : null; - if (!isVisible) return null; + if (!isVisible || !isDesktop) return null; return (