fix(web): restore tool expansion directly

This commit is contained in:
Miguel Palhas
2026-09-05 08:59:20 +01:00
parent 443800bd79
commit 4a5c3b9982
3 changed files with 21 additions and 11 deletions
+1 -2
View File
@@ -162,12 +162,11 @@ export function createStructuredConnection(
const oldToolHead = old?.querySelector<HTMLButtonElement>(".st-tool-head") ?? null;
const wasExpanded = oldToolHead?.getAttribute("aria-expanded") === "true";
const restoreFocus = document.activeElement === oldToolHead;
const el = buildTranscriptRow(row, approvalStateFor(row));
const el = buildTranscriptRow(row, approvalStateFor(row), wasExpanded);
rowEls.set(row.id, el);
if (old) old.replaceWith(el);
else rowsEl.appendChild(el);
const newToolHead = el.querySelector<HTMLButtonElement>(".st-tool-head");
if (wasExpanded) newToolHead?.click();
if (restoreFocus) newToolHead?.focus();
}