diff --git a/client/src/components/SidePanel/ArtifactsPanel.tsx b/client/src/components/SidePanel/ArtifactsPanel.tsx index 1ea644e9b9..cbdb8d2832 100644 --- a/client/src/components/SidePanel/ArtifactsPanel.tsx +++ b/client/src/components/SidePanel/ArtifactsPanel.tsx @@ -2,8 +2,6 @@ import { useRef, useEffect, memo } from 'react'; import { ResizableHandleAlt, ResizablePanel } from '@librechat/client'; import type { ImperativePanelHandle } from 'react-resizable-panels'; -const ANIMATION_DURATION = 500; - interface ArtifactsPanelProps { artifacts: React.ReactNode | null; currentLayout: number[]; @@ -24,14 +22,9 @@ const ArtifactsPanel = memo(function ArtifactsPanel({ onRenderChange, }: ArtifactsPanelProps) { const artifactsPanelRef = useRef(null); - const timeoutRef = useRef(null); useEffect(() => { if (artifacts != null) { - if (timeoutRef.current) { - clearTimeout(timeoutRef.current); - timeoutRef.current = null; - } onRenderChange(true); requestAnimationFrame(() => { requestAnimationFrame(() => { @@ -39,17 +32,8 @@ const ArtifactsPanel = memo(function ArtifactsPanel({ }); }); } else if (shouldRender) { - artifactsPanelRef.current?.collapse(); - timeoutRef.current = setTimeout(() => { - onRenderChange(false); - }, ANIMATION_DURATION); + onRenderChange(false); } - - return () => { - if (timeoutRef.current) { - clearTimeout(timeoutRef.current); - } - }; }, [artifacts, shouldRender, onRenderChange]); if (!shouldRender) { diff --git a/client/src/components/SidePanel/SidePanel.tsx b/client/src/components/SidePanel/SidePanel.tsx index 35c164a91c..8a711ce9db 100644 --- a/client/src/components/SidePanel/SidePanel.tsx +++ b/client/src/components/SidePanel/SidePanel.tsx @@ -162,6 +162,9 @@ const SidePanel = ({ transition: 'width 0.2s ease, visibility 0s linear 0.2s', }} onExpand={() => { + if (isCollapsed && (fullCollapse || collapsedSize === 0)) { + return; + } setIsCollapsed(false); localStorage.setItem('react-resizable-panels:collapsed', 'false'); }} diff --git a/client/src/components/SidePanel/SidePanelGroup.tsx b/client/src/components/SidePanel/SidePanelGroup.tsx index 11761d75d9..5a81f088df 100644 --- a/client/src/components/SidePanel/SidePanelGroup.tsx +++ b/client/src/components/SidePanel/SidePanelGroup.tsx @@ -138,9 +138,9 @@ const SidePanelGroup = memo( setCollapsedSize={setCollapsedSize} fullCollapse={fullCollapse} setFullCollapse={setFullCollapse} - defaultSize={currentLayout[currentLayout.length - 1]} - hasArtifacts={artifacts != null} interfaceConfig={interfaceConfig} + hasArtifacts={shouldRenderArtifacts} + defaultSize={currentLayout[currentLayout.length - 1]} /> )}