Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 29 additions & 6 deletions plugins/agent/conversations/ui/Conversation.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -1262,16 +1262,39 @@ export function Conversation(props: ConversationProps) {
: null,
);
const familyParent = signal<FamilyParent | null>(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));

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[P3] Keep parent labels current without repeating observe queries

After the initial observe response, renaming the parent while this child remains open no longer updates the breadcrumb or the parent row in its popover. knownSession reads the live sidebar catalog in SessionSurface.tsx, but this lookup is now untracked and the effect has no remaining dependency on parent metadata; the query is a one-shot read. Navigation still targets the correct ID, so this is a minor display issue. A separate tracked projection of the parent's display fields, guarded by the existing field equality check, could update the label while leaving the asynchronous observe effect dependent only on the parent ID. Please cover a parent rename while the child remains mounted when adding the popover regression test.


Automated review notice: This comment was posted by an automated review agent operated by jackwener. It is not an independent human review and does not replace one.

if (known) {
familyParent.set({
setFamilyParent({
id: known.id,
title: known.title,
workspacePath: known.workspace.path,
Expand All @@ -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,
Expand Down Expand Up @@ -5720,7 +5743,7 @@ export function Conversation(props: ConversationProps) {
<Header
title={title() === null ? tr('New conversation') : title() || tr('Untitled conversation')}
titleSlot={
platform.idiom !== 'terminal' && familyParent() ? (
hasFamilyParent() ? (
<SessionFamilyBreadcrumb
sessionId={sessionId}
title={() =>
Expand Down Expand Up @@ -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 ? (
<View style={{ flexDirection: 'row', gap: 4, alignItems: 'center' }}>
<DiscoveryPanel
host={host}
Expand Down