From 51349ecae51ebd1a6694749e81dcfc4bafd27222 Mon Sep 17 00:00:00 2001 From: Dustin Healy <54083382+dustinhealy@users.noreply.github.com> Date: Wed, 18 Nov 2026 18:53:49 -0800 Subject: [PATCH] fix: Preserve Loading Side Chat Drafts --- .../src/components/Chat/Presentation.test.tsx | 56 +++- client/src/components/Chat/Presentation.tsx | 20 +- e2e/specs/mock/subagent-activity.spec.ts | 298 ++++++++++++------ .../components/side/__tests__/panel.spec.tsx | 159 +++++++++- packages/chat/src/components/side/panel.tsx | 81 ++++- packages/chat/src/react.ts | 1 + .../src/react/side/__tests__/state.spec.ts | 83 +++++ packages/chat/src/react/side/state.ts | 40 ++- 8 files changed, 593 insertions(+), 145 deletions(-) create mode 100644 packages/chat/src/react/side/__tests__/state.spec.ts diff --git a/client/src/components/Chat/Presentation.test.tsx b/client/src/components/Chat/Presentation.test.tsx index 513f1d8aa61..a26c6852e5e 100644 --- a/client/src/components/Chat/Presentation.test.tsx +++ b/client/src/components/Chat/Presentation.test.tsx @@ -12,6 +12,7 @@ import { sideChatAvailableAtom, } from '@librechat/chat/react'; import type { TConversation, TStartupConfig } from 'librechat-data-provider'; +import type { SideChat } from '@librechat/chat/react'; import type { JotaiStore } from 'test/harness'; import type { Artifact } from '~/common'; import { prepareUndockedDocument } from '~/components/Artifacts/undockedWindow'; @@ -39,6 +40,11 @@ const mockOpenChildLabel = 'Open Child Activity'; const mockSideChatLabel = 'Side chat loaded'; const mockOpenSideChatLabel = 'Open Side Chat'; const mockAskSideChatLabel = 'Ask for a side chat'; +let mockSideChatProps: { + chat: SideChat; + onClose: () => void; + onHandedTextTaken: (expected: SideChat) => void; +}; const mockSelectAgentConversationLabel = 'Select Agent Conversation'; const mockStartAgentRunLabel = 'Start Agent Run'; /** @@ -86,7 +92,8 @@ jest.mock('@librechat/chat/components', () => { ), loadSideChatPanel: () => Promise.resolve({ - default: function MockSideChatPanel() { + default: function MockSideChatPanel(props: typeof mockSideChatProps) { + mockSideChatProps = props; const parent = useParentSubagents(); return (