π€― LobeHub - Super-Agents on Your Team. Add super-agents to the chats your team already uses.They take on work by themselves and get better every week.
TypeScript agentagent-collaborationagent-harnessloop-engineeringmcppersonal-assistantproactive-agentskillssuper-agenttask-management
π fix(agent): stop auto-collapsing right working panel on chat mount (#14883)
Arvin Xu6434ee9a5dfe
diff --git a/src/features/RightPanel/ToggleRightPanelButton.tsx b/src/features/RightPanel/ToggleRightPanelButton.tsxindex 08b3cdf66fa..49623426829 100644--- a/src/features/RightPanel/ToggleRightPanelButton.tsx+++ b/src/features/RightPanel/ToggleRightPanelButton.tsx@@ -32,9 +32,10 @@ interface ToggleRightPanelButtonProps {const ToggleRightPanelButton = memo<ToggleRightPanelButtonProps>(({ title, showActive, icon, hideWhenExpanded, size, expand: expandProp, onToggle }) => {- const [globalExpand, globalToggle] = useGlobalStore((s) => [+ const [globalExpand, globalToggle, isStatusInit] = useGlobalStore((s) => [systemStatusSelectors.showRightPanel(s),s.toggleRightPanel,+ systemStatusSelectors.isStatusInit(s),]);const hotkey = useUserStore(settingsSelectors.getHotkeyById(HotkeyEnum.ToggleRightPanel));@@ -43,6 +44,11 @@ const ToggleRightPanelButton = memo<ToggleRightPanelButtonProps>(const expand = expandProp ?? globalExpand;const handleClick = onToggle ?? (() => globalToggle());+ // Defer render until status hydrates when relying on the global store β+ // toggleRightPanel is a no-op while !isStatusInit and clicks would be+ // silently dropped. Callers that pass `expand`+`onToggle` override this.+ if (expandProp === undefined && !isStatusInit) return null;+if (hideWhenExpanded && expand) return null;return (<ActionIcondiff --git a/src/routes/(main)/agent/features/Conversation/Header/ParamsPanelToggle/index.tsx b/src/routes/(main)/agent/features/Conversation/Header/ParamsPanelToggle/index.tsxindex 0cb5695cd1c..1fb2b9e1408 100644--- a/src/routes/(main)/agent/features/Conversation/Header/ParamsPanelToggle/index.tsx+++ b/src/routes/(main)/agent/features/Conversation/Header/ParamsPanelToggle/index.tsx@@ -16,12 +16,13 @@ const ParamsPanelToggle = memo(() => {const { t } = useTranslation('setting');const { pathname } = useLocation();const isHetero = useAgentStore(agentSelectors.isCurrentAgentHeterogeneous);- const [showRightPanel, workingSidebarTab, setWorkingSidebarTab, toggleRightPanel] =+ const [showRightPanel, workingSidebarTab, setWorkingSidebarTab, toggleRightPanel, isStatusInit] =useGlobalStore((s) => [systemStatusSelectors.showRightPanel(s),s.status.workingSidebarTab,s.setWorkingSidebarTab,s.toggleRightPanel,+ systemStatusSelectors.isStatusInit(s),]);const active = showRightPanel && workingSidebarTab === 'params';@@ -38,6 +39,10 @@ const ParamsPanelToggle = memo(() => {if (isHetero || pathname.startsWith('/popup')) return null;+ // Defer render until status hydrates β toggleRightPanel is a no-op while+ // !isStatusInit and clicks would be silently dropped.+ if (!isStatusInit) return null;+return (<ActionIconactive={active}diff --git a/src/routes/(main)/agent/features/Conversation/Header/WorkingPanelToggle/index.tsx b/src/routes/(main)/agent/features/Conversation/Header/WorkingPanelToggle/index.tsxindex da57a6534ba..3f196077f6e 100644--- a/src/routes/(main)/agent/features/Conversation/Header/WorkingPanelToggle/index.tsx+++ b/src/routes/(main)/agent/features/Conversation/Header/WorkingPanelToggle/index.tsx@@ -13,27 +13,32 @@ import { systemStatusSelectors } from '@/store/global/selectors';const WorkingPanelToggle = memo(() => {const { t } = useTranslation('chat');const { pathname } = useLocation();- const [showRightPanel, toggleRightPanel] = useGlobalStore((s) => [+ const [showRightPanel, toggleRightPanel, isStatusInit] = useGlobalStore((s) => [systemStatusSelectors.showRightPanel(s),s.toggleRightPanel,+ systemStatusSelectors.isStatusInit(s),]);- const setWorkingSidebarTab = useGlobalStore((s) => s.setWorkingSidebarTab);// The popup window has no WorkingSidebar β hide the toggle to avoid a// button that does nothing visible.if (pathname.startsWith('/popup')) return null;+ // Defer render until status hydrates β updateSystemStatus is a no-op while+ // !isStatusInit, so clicks here would otherwise be silently dropped.+ if (!isStatusInit) return null;+if (showRightPanel) return null;+ // Open the panel without touching the tab preference β the sidebar's own+ // resolveActiveTab will pick the right default (and honor the user's last+ // explicit click). Force-setting `review` here would overwrite a previously+ // picked Space/Files tab every time the panel is re-opened.return (<ActionIconicon={PanelRightOpenIcon}size={DESKTOP_HEADER_ICON_SMALL_SIZE}title={t('workingPanel.title')}- onClick={() => {- setWorkingSidebarTab('review');- toggleRightPanel(true);- }}+ onClick={() => toggleRightPanel(true)}/>);});diff --git a/src/routes/(main)/agent/features/Conversation/index.tsx b/src/routes/(main)/agent/features/Conversation/index.tsxindex 85b6543b3cd..20c3bd1830a 100644--- a/src/routes/(main)/agent/features/Conversation/index.tsx+++ b/src/routes/(main)/agent/features/Conversation/index.tsx@@ -1,12 +1,10 @@import { Flexbox, TooltipGroup } from '@lobehub/ui';-import React, { memo, Suspense, useEffect } from 'react';+import React, { memo, Suspense } from 'react';import DragUploadZone, { useUploadFiles } from '@/components/DragUploadZone';import Loading from '@/components/Loading/BrandTextLoading';import { useAgentStore } from '@/store/agent';import { agentSelectors } from '@/store/agent/selectors';-import { useGlobalStore } from '@/store/global';-import { systemStatusSelectors } from '@/store/global/selectors';import ConversationArea from './ConversationArea';@@ -18,18 +16,10 @@ const wrapperStyle: React.CSSProperties = {};const ChatConversation = memo(() => {- const isStatusInit = useGlobalStore(systemStatusSelectors.isStatusInit);-- // Get current agent's model info for vision support checkconst model = useAgentStore(agentSelectors.currentAgentModel);const provider = useAgentStore(agentSelectors.currentAgentModelProvider);const { handleUploadFiles } = useUploadFiles({ model, provider });- useEffect(() => {- if (!isStatusInit) return;- useGlobalStore.getState().toggleRightPanel(false);- }, [isStatusInit]);-return (<Suspense fallback={<Loading debugId="Agent > ChatConversation" />}><DragUploadZone style={wrapperStyle} onUploadFiles={handleUploadFiles}>diff --git a/src/store/global/action.test.ts b/src/store/global/action.test.tsindex ee8b1cec985..2fe98d700dc 100644--- a/src/store/global/action.test.ts+++ b/src/store/global/action.test.ts@@ -36,6 +36,7 @@ describe('createPreferenceSlice', () => {const { result } = renderHook(() => useGlobalStore());act(() => {+ useGlobalStore.setState({ isStatusInit: true });useGlobalStore.getState().updateSystemStatus({ showRightPanel: false });result.current.toggleRightPanel();});diff --git a/src/store/global/initialState.ts b/src/store/global/initialState.tsindex 0470183a14b..77f86017870 100644--- a/src/store/global/initialState.ts+++ b/src/store/global/initialState.ts@@ -370,7 +370,7 @@ export const INITIAL_STATUS = {showImageTopicPanel: true,showLeftPanel: true,showPageAgentPanel: true,- showRightPanel: true,+ showRightPanel: false,showSystemRole: false,showTaskAgentPanel: false,showVideoPanel: true,