diff --git a/src/components/layout/RightPanel.tsx b/src/components/layout/RightPanel.tsx index e55cbe31..46998e01 100644 --- a/src/components/layout/RightPanel.tsx +++ b/src/components/layout/RightPanel.tsx @@ -1,6 +1,6 @@ "use client"; -import { useCallback } from "react"; +import { useCallback, useSyncExternalStore } from "react"; import { HugeiconsIcon } from "@hugeicons/react"; import { StructureFolderIcon, PanelRightCloseIcon } from "@hugeicons/core-free-icons"; import { Button } from "@/components/ui/button"; @@ -21,6 +21,9 @@ interface RightPanelProps { export function RightPanel({ width }: RightPanelProps) { const { panelOpen, setPanelOpen, workingDirectory, sessionId, previewFile, setPreviewFile } = usePanel(); const { t } = useTranslation(); + const emptySubscribe = useCallback(() => () => {}, []); + const mounted = useSyncExternalStore(emptySubscribe, () => true, () => false); + const isWindows = mounted && /windows/i.test(navigator.userAgent); const handleFileAdd = useCallback((path: string) => { window.dispatchEvent(new CustomEvent('attach-file-to-chat', { detail: { path } })); @@ -50,7 +53,7 @@ export function RightPanel({ width }: RightPanelProps) { if (!panelOpen) { return ( -