Enhanced ChatGPT Clone: Features Agents, MCP, Skills, DeepSeek, Anthropic, AWS, OpenAI, Responses API, Azure, Groq, o1, GPT-5, Mistral, OpenRouter, Vertex AI, Gemini, Artifacts, AI model switching, message search, Code Interpreter, langchain, DALL-E-3, OpenAPI Actions, Functions, Secure Multi-User Auth, Presets, open-source for self-hosting. Active
TypeScript aianthropicartifactsawsazurechatgptchatgpt-cloneclaudeclonedeepseekgeminigooglegpt-5librechatmcpo1openairesponses-apivisionwebui
🎛️ refactor: Pass the New-Chat Panel Preference Into the Sidebar (#16605)
Marco Beretta66dd6920284c
diff --git a/client/src/components/UnifiedSidebar/ExpandedPanel.tsx b/client/src/components/UnifiedSidebar/ExpandedPanel.tsxindex 471bf2f987..82c85291db 100644--- a/client/src/components/UnifiedSidebar/ExpandedPanel.tsx+++ b/client/src/components/UnifiedSidebar/ExpandedPanel.tsx@@ -1,5 +1,4 @@import { memo, useCallback, lazy, Suspense } from 'react';-import { useRecoilValue } from 'recoil';import { SquarePen } from 'lucide-react';import { useLocation } from 'react-router-dom';import { Skeleton, Sidebar, Button, TooltipAnchor } from '@librechat/client';@@ -11,17 +10,17 @@ import { CLOSE_SIDEBAR_ID } from '~/components/Chat/Menus/OpenSidebar';import useNewChat from '~/hooks/Chat/useNewChat';import { useLocalize } from '~/hooks';import { cn } from '~/utils';-import store from '~/store';const AccountSettings = lazy(() => import('~/components/Nav/AccountSettings'));const NewChatButton = memo(function NewChatButton({setActive,+ switchToHistory,}: {setActive: (id: string) => void;+ switchToHistory: boolean;}) {const localize = useLocalize();- const switchToHistory = useRecoilValue(store.newChatSwitchToHistory);const tooltipDescription = useShortcutHint('newChat', localize('com_ui_new_chat'));const ariaKey = useShortcutAriaKey('newChat');@@ -129,6 +128,7 @@ function ExpandedPanel({onExpand,onNavigate,onLeaveInsights,+ switchToHistory,}: {links: NavLink[];expanded?: boolean;@@ -136,6 +136,7 @@ function ExpandedPanel({onExpand?: () => void;onNavigate?: () => void;onLeaveInsights?: () => void;+ switchToHistory: boolean;}) {const localize = useLocalize();const location = useLocation();@@ -169,7 +170,7 @@ function ExpandedPanel({</Button>}/>- <NewChatButton setActive={setActive} />+ <NewChatButton setActive={setActive} switchToHistory={switchToHistory} /><AgentMarketplaceButton /><div className="border-border-light mx-2 border-b" /><div className="flex flex-col gap-1 overflow-y-auto">diff --git a/client/src/components/UnifiedSidebar/Sidebar.tsx b/client/src/components/UnifiedSidebar/Sidebar.tsxindex 319b6651ad..ef048b6c60 100644--- a/client/src/components/UnifiedSidebar/Sidebar.tsx+++ b/client/src/components/UnifiedSidebar/Sidebar.tsx@@ -13,6 +13,7 @@ function Sidebar({onCollapse,onExpand,onLeaveInsights,+ switchToHistory,onResizeStart,onResizeKeyboard,}: {@@ -24,6 +25,7 @@ function Sidebar({onCollapse: () => void;onExpand: () => void;onLeaveInsights: () => void;+ switchToHistory: boolean;onResizeStart: (e: React.MouseEvent) => void;onResizeKeyboard: (direction: 'shrink' | 'grow') => void;}) {@@ -36,6 +38,7 @@ function Sidebar({onCollapse={onCollapse}onExpand={onExpand}onLeaveInsights={onLeaveInsights}+ switchToHistory={switchToHistory}/><navclassName={cn(diff --git a/client/src/components/UnifiedSidebar/UnifiedSidebar.tsx b/client/src/components/UnifiedSidebar/UnifiedSidebar.tsxindex 9c60796467..0b2bd54f9e 100644--- a/client/src/components/UnifiedSidebar/UnifiedSidebar.tsx+++ b/client/src/components/UnifiedSidebar/UnifiedSidebar.tsx@@ -50,7 +50,15 @@ function SidebarChatProvider({ children }: { children: ReactNode }) {);}-function UnifiedSidebar({ isSliding = false }: { isSliding?: boolean }) {+function UnifiedSidebar({+ isSliding = false,+ switchToHistory,+}: {+ isSliding?: boolean;+ /** The user's "new chat returns to the chat list" preference. App-global+ * shell state the sidebar only reads, so the host passes it in. */+ switchToHistory: boolean;+}) {const localize = useLocalize();const location = useLocation();const navigate = useNavigate();@@ -227,6 +235,7 @@ function UnifiedSidebar({ isSliding = false }: { isSliding?: boolean }) {expanded={expanded}onClose={handleCollapse}onNewChat={handleCollapse}+ switchToHistory={switchToHistory}onLeaveInsights={handleLeaveInsights}routeActiveId={isInsightsRoute ? 'insights' : undefined}/>@@ -276,6 +285,7 @@ function UnifiedSidebar({ isSliding = false }: { isSliding?: boolean }) {onCollapse={handleCollapse}onExpand={handlePanelExpand}onLeaveInsights={handleLeaveInsights}+ switchToHistory={switchToHistory}onResizeStart={handleResizeStart}onResizeKeyboard={handleResizeKeyboard}/>diff --git a/client/src/components/UnifiedSidebar/__tests__/ExpandedPanel.spec.tsx b/client/src/components/UnifiedSidebar/__tests__/ExpandedPanel.spec.tsxindex feab690f2a..668cb688b3 100644--- a/client/src/components/UnifiedSidebar/__tests__/ExpandedPanel.spec.tsx+++ b/client/src/components/UnifiedSidebar/__tests__/ExpandedPanel.spec.tsx@@ -5,7 +5,6 @@ import { MemoryRouter } from 'react-router-dom';import { MessagesSquare, NotebookPen } from 'lucide-react';import { render, fireEvent, screen } from '@testing-library/react';import { QueryClient, QueryClientProvider } from '@tanstack/react-query';-import type { MutableSnapshot } from 'recoil';import type { NavLink } from '~/common';import { ActivePanelProvider, DEFAULT_PANEL } from '~/Providers';@@ -15,10 +14,6 @@ const mockClearMessagesCache = jest.fn();jest.mock('~/store', () => {const { atom } = jest.requireActual('recoil');let counter = 0;- const switchAtom = atom({- key: 'mock-newChatSwitchToHistory',- default: true,- });const customShortcutsAtom = atom({key: 'mock-customShortcuts',default: {},@@ -34,7 +29,6 @@ jest.mock('~/store', () => {atom({ key: `mock-conversationByIndex-${counter++}`, default: null }),conversationIdByIndex: () =>atom({ key: `mock-conversationIdByIndex-${counter++}`, default: null }),- newChatSwitchToHistory: switchAtom,customShortcuts: customShortcutsAtom,shortcutsEnabled: shortcutsEnabledAtom,},@@ -87,7 +81,6 @@ jest.mock('~/components/Nav/AccountSettings', () => ({}));import ExpandedPanel from '../ExpandedPanel';-import store from '~/store';const createLinks = (): NavLink[] => [{@@ -111,7 +104,7 @@ function renderPanel({onExpand = jest.fn(),onNavigate,initialPanel = DEFAULT_PANEL,- initializeState,+ switchToHistory = true,}: {expanded?: boolean;links?: NavLink[];@@ -119,7 +112,7 @@ function renderPanel({onExpand?: jest.Mock;onNavigate?: jest.Mock;initialPanel?: string;- initializeState?: (snapshot: MutableSnapshot) => void;+ switchToHistory?: boolean;} = {}) {if (initialPanel !== DEFAULT_PANEL) {localStorage.setItem('side:active-panel', initialPanel);@@ -128,7 +121,7 @@ function renderPanel({const result = render(<MemoryRouter><QueryClientProvider client={createQueryClient()}>- <RecoilRoot initializeState={initializeState}>+ <RecoilRoot><ActivePanelProvider><ExpandedPanellinks={links}@@ -136,6 +129,7 @@ function renderPanel({onCollapse={onCollapse}onExpand={onExpand}onNavigate={onNavigate}+ switchToHistory={switchToHistory}/></ActivePanelProvider></RecoilRoot>@@ -219,9 +213,7 @@ describe('ExpandedPanel', () => {renderPanel({expanded: true,initialPanel: 'prompts',- initializeState: ({ set }: MutableSnapshot) => {- set(store.newChatSwitchToHistory, false);- },+ switchToHistory: false,});const newChatLink = screen.getByTestId('new-chat-button');diff --git a/client/src/components/UnifiedSidebar/__tests__/drawerPaint.spec.tsx b/client/src/components/UnifiedSidebar/__tests__/drawerPaint.spec.tsxindex e939e2d452..bae4c5548d 100644--- a/client/src/components/UnifiedSidebar/__tests__/drawerPaint.spec.tsx+++ b/client/src/components/UnifiedSidebar/__tests__/drawerPaint.spec.tsx@@ -71,7 +71,7 @@ const drawerVisibility = (expanded: boolean, isSliding: boolean): string => {mockSidebarState.expanded = expanded;const { unmount } = render(<MemoryRouter>- <UnifiedSidebar isSliding={isSliding} />+ <UnifiedSidebar isSliding={isSliding} switchToHistory={true} /></MemoryRouter>,);const drawer = document.getElementById(MOBILE_DRAWER_ID);diff --git a/client/src/components/UnifiedSidebar/mobile/Header.tsx b/client/src/components/UnifiedSidebar/mobile/Header.tsxindex fd03602658..8def10b126 100644--- a/client/src/components/UnifiedSidebar/mobile/Header.tsx+++ b/client/src/components/UnifiedSidebar/mobile/Header.tsx@@ -22,6 +22,7 @@ function Header({expanded,onClose,onNewChat,+ switchToHistory,onLeaveInsights,routeActiveId,}: {@@ -29,6 +30,7 @@ function Header({expanded: boolean;onClose: () => void;onNewChat: (afterSlide?: () => void) => void;+ switchToHistory: boolean;onLeaveInsights?: () => void;routeActiveId?: string;}) {@@ -77,7 +79,7 @@ function Header({onNavigate={onClose}routeActiveId={routeActiveId}/>- <NewChat onNewChat={onNewChat} />+ <NewChat onNewChat={onNewChat} switchToHistory={switchToHistory} /><Suspense fallback={<Skeleton className="size-9 rounded-lg" />}><AccountSettings collapsed /></Suspense>diff --git a/client/src/components/UnifiedSidebar/mobile/NewChat.tsx b/client/src/components/UnifiedSidebar/mobile/NewChat.tsxindex 7c40dfc945..9e17a22bfe 100644--- a/client/src/components/UnifiedSidebar/mobile/NewChat.tsx+++ b/client/src/components/UnifiedSidebar/mobile/NewChat.tsx@@ -1,12 +1,10 @@import { memo, useCallback } from 'react';-import { useRecoilValue } from 'recoil';import { SquarePen } from 'lucide-react';import { Button, TooltipAnchor } from '@librechat/client';import { useShortcutAriaKey } from '~/hooks/useKeyboardShortcuts';import { useActivePanel, DEFAULT_PANEL } from '~/Providers';import useNewChat from '~/hooks/Chat/useNewChat';import { useLocalize } from '~/hooks';-import store from '~/store';/*** New chat, in the drawer's header strip beside the panel switcher.@@ -16,9 +14,14 @@ import store from '~/store';* header is where the drawer keeps the controls that mean the same thing* whichever panel is showing.*/-function NewChat({ onNewChat }: { onNewChat: (afterSlide?: () => void) => void }) {+function NewChat({+ onNewChat,+ switchToHistory,+}: {+ onNewChat: (afterSlide?: () => void) => void;+ switchToHistory: boolean;+}) {const localize = useLocalize();- const switchToHistory = useRecoilValue(store.newChatSwitchToHistory);const { setActive } = useActivePanel();const { startNewChat } = useNewChat();diff --git a/client/src/components/UnifiedSidebar/mobile/__tests__/Header.spec.tsx b/client/src/components/UnifiedSidebar/mobile/__tests__/Header.spec.tsxindex 4f4f961ee5..8cf5160ca0 100644--- a/client/src/components/UnifiedSidebar/mobile/__tests__/Header.spec.tsx+++ b/client/src/components/UnifiedSidebar/mobile/__tests__/Header.spec.tsx@@ -52,9 +52,18 @@ const links = [] as NavLink[];describe('mobile drawer header', () => {it('claims the close identity while the drawer is open', () => {- render(<Header links={links} expanded={true} onClose={jest.fn()} onNewChat={jest.fn()} />, {- wrapper: MemoryRouter,- });+ render(+ <Header+ links={links}+ expanded={true}+ onClose={jest.fn()}+ onNewChat={jest.fn()}+ switchToHistory={true}+ />,+ {+ wrapper: MemoryRouter,+ },+ );const close = screen.getByTestId('close-sidebar-button');expect(close).toHaveAttribute('id', 'close-sidebar-button');@@ -67,9 +76,18 @@ describe('mobile drawer header', () => {* would find one sitting off-viewport and act on it.*/it('gives up that identity once closed', () => {- render(<Header links={links} expanded={false} onClose={jest.fn()} onNewChat={jest.fn()} />, {- wrapper: MemoryRouter,- });+ render(+ <Header+ links={links}+ expanded={false}+ onClose={jest.fn()}+ onNewChat={jest.fn()}+ switchToHistory={true}+ />,+ {+ wrapper: MemoryRouter,+ },+ );expect(screen.queryByTestId('close-sidebar-button')).not.toBeInTheDocument();expect(document.getElementById('close-sidebar-button')).toBeNull();@@ -77,9 +95,18 @@ describe('mobile drawer header', () => {/** The only close control while open, so its binding must be discoverable here. */it('advertises the toggle shortcut on the close control', () => {- render(<Header links={links} expanded={true} onClose={jest.fn()} onNewChat={jest.fn()} />, {- wrapper: MemoryRouter,- });+ render(+ <Header+ links={links}+ expanded={true}+ onClose={jest.fn()}+ onNewChat={jest.fn()}+ switchToHistory={true}+ />,+ {+ wrapper: MemoryRouter,+ },+ );expect(screen.getByTestId('close-sidebar-button')).toHaveAttribute('aria-keyshortcuts',@@ -88,9 +115,18 @@ describe('mobile drawer header', () => {});it('keeps the closed drawer out of the tab order', () => {- render(<Header links={links} expanded={false} onClose={jest.fn()} onNewChat={jest.fn()} />, {- wrapper: MemoryRouter,- });+ render(+ <Header+ links={links}+ expanded={false}+ onClose={jest.fn()}+ onNewChat={jest.fn()}+ switchToHistory={true}+ />,+ {+ wrapper: MemoryRouter,+ },+ );expect(screen.getByLabelText('com_nav_close_sidebar')).toHaveAttribute('tabindex', '-1');});@@ -103,22 +139,45 @@ describe('mobile drawer header', () => {*/it('moves focus to the toggle when the drawer opens', () => {const { rerender } = render(- <Header links={links} expanded={false} onClose={jest.fn()} onNewChat={jest.fn()} />,+ <Header+ links={links}+ expanded={false}+ onClose={jest.fn()}+ onNewChat={jest.fn()}+ switchToHistory={true}+ />,{wrapper: MemoryRouter,},);expect(document.activeElement).toBe(document.body);- rerender(<Header links={links} expanded={true} onClose={jest.fn()} onNewChat={jest.fn()} />);+ rerender(+ <Header+ links={links}+ expanded={true}+ onClose={jest.fn()}+ onNewChat={jest.fn()}+ switchToHistory={true}+ />,+ );expect(document.activeElement).toBe(screen.getByTestId('close-sidebar-button'));});it('never steals focus while closed', () => {- render(<Header links={links} expanded={false} onClose={jest.fn()} onNewChat={jest.fn()} />, {- wrapper: MemoryRouter,- });+ render(+ <Header+ links={links}+ expanded={false}+ onClose={jest.fn()}+ onNewChat={jest.fn()}+ switchToHistory={true}+ />,+ {+ wrapper: MemoryRouter,+ },+ );expect(document.activeElement).toBe(document.body);});@@ -130,7 +189,13 @@ describe('mobile drawer header', () => {*/it('leads the row with the shared header-action toggle', () => {const { container } = render(- <Header links={links} expanded={true} onClose={jest.fn()} onNewChat={jest.fn()} />,+ <Header+ links={links}+ expanded={true}+ onClose={jest.fn()}+ onNewChat={jest.fn()}+ switchToHistory={true}+ />,{wrapper: MemoryRouter,},@@ -146,9 +211,18 @@ describe('mobile drawer header', () => {* switcher because it means the same thing whichever panel is showing, which* is exactly why it no longer repeats under each panel's contents. */it('carries new chat in the strip, and not the marketplace', () => {- render(<Header links={links} expanded={true} onClose={jest.fn()} onNewChat={jest.fn()} />, {- wrapper: MemoryRouter,- });+ render(+ <Header+ links={links}+ expanded={true}+ onClose={jest.fn()}+ onNewChat={jest.fn()}+ switchToHistory={true}+ />,+ {+ wrapper: MemoryRouter,+ },+ );expect(screen.getByTestId('nav-new-chat-fab')).toBeInTheDocument();expect(screen.queryByTestId('nav-agents-marketplace-button')).not.toBeInTheDocument();diff --git a/client/src/components/UnifiedSidebar/mobile/__tests__/NewChat.spec.tsx b/client/src/components/UnifiedSidebar/mobile/__tests__/NewChat.spec.tsxindex 4a6cbd5e08..f9bd8b9f66 100644--- a/client/src/components/UnifiedSidebar/mobile/__tests__/NewChat.spec.tsx+++ b/client/src/components/UnifiedSidebar/mobile/__tests__/NewChat.spec.tsx@@ -24,8 +24,9 @@ jest.mock('@librechat/client', () => ({useToastContext: () => ({ showToast: jest.fn() }),}));+const mockSetActive = jest.fn();jest.mock('~/Providers', () => ({- useActivePanel: () => ({ active: 'conversations', setActive: jest.fn() }),+ useActivePanel: () => ({ active: 'conversations', setActive: mockSetActive }),resolveActivePanel: () => 'conversations',DEFAULT_PANEL: 'conversations',}));@@ -73,7 +74,7 @@ describe('mobile header new chat', () => {render(<QueryClientProvider client={queryClient}><RecoilRoot>- <NewChat onNewChat={onNewChat} />+ <NewChat onNewChat={onNewChat} switchToHistory={true} /></RecoilRoot></QueryClientProvider>,);@@ -91,7 +92,7 @@ describe('mobile header new chat', () => {render(<QueryClientProvider client={queryClient}><RecoilRoot>- <NewChat onNewChat={onNewChat} />+ <NewChat onNewChat={onNewChat} switchToHistory={true} /></RecoilRoot></QueryClientProvider>,);@@ -100,4 +101,29 @@ describe('mobile header new chat', () => {expect(onNewChat).not.toHaveBeenCalled();expect(mockNewConversation).not.toHaveBeenCalled();});+ /** The host supplies the "new chat returns to the chat list" preference;+ * the switch-back rides the same afterSlide as the reset. */+ it.each([+ [true, 1],+ [false, 0],+ ])('with switchToHistory=%s returns to the chat list %i time(s)', (switchToHistory, calls) => {+ let afterSlide: (() => void) | undefined;+ const onNewChat = jest.fn((callback?: () => void) => {+ afterSlide = callback;+ });+ render(+ <QueryClientProvider client={queryClient}>+ <RecoilRoot>+ <NewChat onNewChat={onNewChat} switchToHistory={switchToHistory} />+ </RecoilRoot>+ </QueryClientProvider>,+ );+ fireEvent.click(screen.getByTestId('nav-new-chat-fab'));+ act(() => afterSlide?.());++ expect(mockSetActive).toHaveBeenCalledTimes(calls);+ if (calls) {+ expect(mockSetActive).toHaveBeenCalledWith('conversations');+ }+ });});diff --git a/client/src/routes/Root.tsx b/client/src/routes/Root.tsxindex 6cbe66937f..338339fee7 100644--- a/client/src/routes/Root.tsx+++ b/client/src/routes/Root.tsx@@ -87,6 +87,7 @@ function RootLayout() {/** Off by default, matching the drawer that covers the screen and closes by* swipe. Opting in narrows it and gives the strip a dismiss target. */const drawerStrip = useRecoilValue(store.mobileDrawerStrip);+ const newChatSwitchToHistory = useRecoilValue(store.newChatSwitchToHistory);const paneRef = useRef<HTMLDivElement>(null);/** Keyed off the committed state rather than the scrim's own click, because* the header button, Escape, conversation selection and the bottom bar all@@ -182,7 +183,10 @@ function RootLayout() {{/* The drawer stops being painted once it is closed andsettled, so it needs the same travel window the scrim andthe pane's `inert` read. */}- <UnifiedSidebar isSliding={isSliding} />+ <UnifiedSidebar+ isSliding={isSliding}+ switchToHistory={newChatSwitchToHistory}+ /><divref={paneRef}/** Focus target of last resort when the drawer closes on adiff --git a/e2e/specs/mock/scenarios/new-chat-panel-preference.spec.ts b/e2e/specs/mock/scenarios/new-chat-panel-preference.spec.tsnew file mode 100644index 0000000000..1edb31dd49--- /dev/null+++ b/e2e/specs/mock/scenarios/new-chat-panel-preference.spec.ts@@ -0,0 +1,100 @@+import { expect, test } from '@playwright/test';+import type { Page } from '@playwright/test';+import { NEW_CHAT_PATH } from '../helpers';++/**+ * "New chat returns to the chat list" is a user preference the host reads and hands to the+ * sidebar. Both new-chat controls follow it: the desktop rail's and the mobile drawer's. With it+ * on, starting a chat from another panel brings the chat list back; with it off, the panel the+ * user was on stays.+ */++const OTHER_PANEL = 'Bookmarks';++async function load(page: Page, switchToHistory: boolean) {+ await page.addInitScript((value) => {+ localStorage.setItem('newChatSwitchToHistory', JSON.stringify(value));+ localStorage.setItem('unifiedSidebarExpanded', JSON.stringify(true));+ localStorage.removeItem('side:active-panel');+ }, switchToHistory);+ await page.goto(NEW_CHAT_PATH, { timeout: 15000 });+ await expect(page.getByRole('textbox', { name: 'Message input' })).toBeVisible({+ timeout: 30000,+ });+}++async function desktopNewChat(page: Page, switchToHistory: boolean) {+ await load(page, switchToHistory);+ const chats = page.getByTestId('nav-panel-conversations');+ const other = page.getByTestId('nav-panel-bookmarks');+ await other.click();+ await expect(other).toHaveAttribute('aria-pressed', 'true');++ await page.getByTestId('new-chat-button').click();+ await expect(page).toHaveURL(/\/c\/new$/);+ return { chats, other };+}++async function mobileNewChat(page: Page, switchToHistory: boolean) {+ await load(page, switchToHistory);+ const drawer = page.locator('#mobile-drawer');+ const openDrawer = async () => {+ if (!(await drawer.getByTestId('close-sidebar-button').isVisible())) {+ await page.getByTestId('header-open-sidebar-button').click();+ }+ await expect(drawer.getByTestId('close-sidebar-button')).toBeVisible();+ await expect(drawer).not.toHaveAttribute('inert');+ };++ await openDrawer();+ const switcher = drawer.getByTestId('panel-switcher-button');+ await switcher.click();+ await page.getByRole('menuitemcheckbox', { name: OTHER_PANEL }).click();+ await expect(switcher).toContainText(OTHER_PANEL);++ await drawer.getByRole('link', { name: 'New chat' }).click();+ await expect(drawer).toHaveAttribute('inert', '');+ await expect(page).toHaveURL(/\/c\/new$/);++ await openDrawer();+ return switcher;+}++test.describe('new chat panel preference, desktop', () => {+ test.use({ viewport: { width: 1280, height: 800 } });++ test('new chat from another panel returns the desktop sidebar to the chat list @scenario:desktop-new-chat-returns-to-chat-list', async ({+ page,+ }) => {+ const { chats, other } = await desktopNewChat(page, true);+ await expect(chats).toHaveAttribute('aria-pressed', 'true');+ await expect(other).toHaveAttribute('aria-pressed', 'false');+ });++ test('with the preference off the desktop sidebar keeps its panel @scenario:desktop-new-chat-keeps-panel-when-off', async ({+ page,+ }) => {+ const { chats, other } = await desktopNewChat(page, false);+ await expect(other).toHaveAttribute('aria-pressed', 'true');+ await expect(chats).toHaveAttribute('aria-pressed', 'false');+ });+});++test.describe('new chat panel preference, mobile drawer', () => {+ /** Loaded at phone width rather than resized into it (berry-13/LibreChat#205). */+ test.use({ viewport: { width: 390, height: 844 } });++ test('new chat from another panel returns the drawer to the chat list @scenario:mobile-new-chat-returns-to-chat-list', async ({+ page,+ }) => {+ const switcher = await mobileNewChat(page, true);+ await expect(switcher).toContainText('Chat History');+ });++ test('with the preference off the drawer keeps its panel @scenario:mobile-new-chat-keeps-panel-when-off', async ({+ page,+ }) => {+ const switcher = await mobileNewChat(page, false);+ await expect(switcher).toContainText(OTHER_PANEL);+ });+});