From 4c3fb32ff1a577152c5095b3b3cd5c8f6e569ef1 Mon Sep 17 00:00:00 2001 From: Turtle Date: Fri, 20 Nov 2026 04:44:10 +0800 Subject: [PATCH] test(web): keep existing unknown casts unchanged in the sidebar chat spec Co-authored-by: liukx0205 <69756503+liukx0205@users.noreply.github.com> Co-authored-by: Yifffan <133629972+Yifffan@users.noreply.github.com> --- .../tests/sidebar-chat.client.spec.tsx | 22 +++++++++++++------ 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/packages/client/ui-subagent/tests/sidebar-chat.client.spec.tsx b/packages/client/ui-subagent/tests/sidebar-chat.client.spec.tsx index a1da2a16fb..aadaf1e43c 100644 --- a/packages/client/ui-subagent/tests/sidebar-chat.client.spec.tsx +++ b/packages/client/ui-subagent/tests/sidebar-chat.client.spec.tsx @@ -82,7 +82,6 @@ describe('Sidebar chat registration', () => { displayTitle: 'Projected title', projectionValues: { subagent: { mode: 'continuable', label: 'Worker', seq: 1 } }, }, - [PARENT]: { displayTitle: 'Root title' }, }, phase: 'ready', projectionsBySession: {}, @@ -106,17 +105,26 @@ describe('Sidebar chat registration', () => { return () => {} }, }, - effect: (install: () => unknown) => { - const dispose = install() - if (typeof dispose === 'function') disposers.push(dispose as () => void) - return () => {} - }, + effect: (install: () => unknown) => { install(); return () => {} }, } as unknown as Context + const childSnapshot = list.getSnapshot + list.getSnapshot = () => { + const snapshot = childSnapshot() + return { ...snapshot, byId: { ...snapshot.byId, [PARENT]: { ...snapshot.byId[CHILD]!, displayTitle: 'Root title', projectionValues: {} } } } + } const openResource = vi.fn() let onScreen: SessionId | undefined = PARENT registerSidebarChat( - Object.assign(ctx, { uiWorkspace: { openWorkspace }, sidebarRight: { openResource, mounted: { getSnapshot: () => onScreen } } }), + Object.assign(ctx, { + uiWorkspace: { openWorkspace }, + sidebarRight: { openResource, mounted: { getSnapshot: () => onScreen } }, + effect: (install: () => unknown) => { + const dispose = install() + if (typeof dispose === 'function') disposers.push(() => { dispose() }) + return () => {} + }, + }), (key: string) => key === 'sidebar.chat' ? 'Chat' : key, )