From 32b4f9ee6fff1791b185105a4a1cf8eba7df845d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9CM4n5ter=E2=80=9D?= Date: Sat, 28 Nov 2026 16:50:18 +0800 Subject: [PATCH] fix(workbench): keep child breadcrumb popover open during catalog updates Stop the familyParent effect in Conversation.tsx from subscribing to browsing.sessions() via knownSession(), and guard Header's titleSlot and actions with boolean computed memos so metadata updates never remount SessionFamilyBreadcrumb and dismiss its open sibling popover. Generated-by: Maka --- .../agent/conversations/ui/Conversation.tsx | 35 +++++++++++++++---- 1 file changed, 29 insertions(+), 6 deletions(-) diff --git a/plugins/agent/conversations/ui/Conversation.tsx b/plugins/agent/conversations/ui/Conversation.tsx index 22938d0588e..cd4f65fca55 100644 --- a/plugins/agent/conversations/ui/Conversation.tsx +++ b/plugins/agent/conversations/ui/Conversation.tsx @@ -1262,16 +1262,39 @@ export function Conversation(props: ConversationProps) { : null, ); const familyParent = signal(null); + const setFamilyParent = (next: FamilyParent | null) => { + const prev = untracked(familyParent); + if ( + prev === next || + (prev && + next && + prev.id === next.id && + prev.title === next.title && + prev.workspacePath === next.workspacePath && + prev.hasGrandparent === next.hasGrandparent && + prev.rootId === next.rootId) + ) { + return; + } + familyParent.set(next); + }; + const hasFamilyParent = computed(() => platform.idiom !== 'terminal' && familyParent() !== null); + const isBotHeader = computed( + () => + bot.identity() === 'bot' && Boolean(props.restartBot) && props.botSession?.() === sessionId, + ); effect(() => { const pid = parentSessionId(); if (props.compact || !pid) { - familyParent.set(null); + setFamilyParent(null); return; } let cancelled = false; - const known = props.knownSession?.(pid); + // Read cached sidebar metadata without subscribing to the entire catalog stream, + // otherwise every active session update re-runs this effect and re-queries observe. + const known = untracked(() => props.knownSession?.(pid)); if (known) { - familyParent.set({ + setFamilyParent({ id: known.id, title: known.title, workspacePath: known.workspace.path, @@ -1286,7 +1309,7 @@ export function Conversation(props: ConversationProps) { const ancestors = obs.session.ancestorIds ?? []; const rootId = ancestors.at(-1) ?? (obs.session.parentSessionId === null ? obs.session.id : null); - familyParent.set({ + setFamilyParent({ id: obs.session.id, title: obs.session.title, workspacePath: obs.session.workspace.path, @@ -5720,7 +5743,7 @@ export function Conversation(props: ConversationProps) {
@@ -5762,7 +5785,7 @@ export function Conversation(props: ConversationProps) { } stage={platform.idiom === 'terminal' || ownHandle.empty() ? undefined : props.stage?.()} actions={ - bot.identity() === 'bot' && props.restartBot && props.botSession?.() === sessionId ? ( + isBotHeader() && props.restartBot ? (