fix(maestro): preserve web tool patch state
This commit is contained in:
@@ -159,10 +159,16 @@ export function createStructuredConnection(
|
||||
|
||||
function remountRow(row: TranscriptRow): void {
|
||||
const old = rowEls.get(row.id);
|
||||
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));
|
||||
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();
|
||||
}
|
||||
|
||||
function applySnapshot(snapshot: { rows: TranscriptRow[] }): void {
|
||||
|
||||
Reference in New Issue
Block a user