From 2bfbab2908cb0a4b35b3f670d87e9ecd9034ae16 Mon Sep 17 00:00:00 2001 From: Polly Labs Date: Wed, 29 Jul 2026 20:22:51 -0500 Subject: [PATCH] Fix duplicate Code tab refresh content --- src/views/codeView.ts | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/views/codeView.ts b/src/views/codeView.ts index 08df64e..78edbdd 100644 --- a/src/views/codeView.ts +++ b/src/views/codeView.ts @@ -117,6 +117,8 @@ export class CodeView extends ItemView { // ---- Usage -------------------------------------------------------------- private async renderUsageTab(body: HTMLElement): Promise { + body.empty(); + const bar = body.createDiv({ cls: "libra-toolbar" }); bar.createSpan({ cls: "libra-section-title", text: "Token & cost usage" }); const refresh = bar.createEl("button", { cls: "clickable-icon", attr: { "aria-label": "Refresh" } }); @@ -124,9 +126,6 @@ export class CodeView extends ItemView { refresh.onclick = () => void this.renderUsageTab(body); const list = body.createDiv(); - // remove any previous content below the toolbar - while (bar.nextSibling) bar.nextSibling.remove(); - body.appendChild(list); list.createDiv({ cls: "libra-muted", text: "Loading usage…" }); try { @@ -157,6 +156,8 @@ export class CodeView extends ItemView { // ---- Automation --------------------------------------------------------- private async renderAutomationTab(body: HTMLElement): Promise { + body.empty(); + const bar = body.createDiv({ cls: "libra-toolbar" }); bar.createSpan({ cls: "libra-section-title", text: "Automation rules" }); const refresh = bar.createEl("button", { cls: "clickable-icon", attr: { "aria-label": "Refresh" } }); @@ -164,8 +165,6 @@ export class CodeView extends ItemView { refresh.onclick = () => void this.renderAutomationTab(body); const list = body.createDiv(); - while (bar.nextSibling) bar.nextSibling.remove(); - body.appendChild(list); list.createDiv({ cls: "libra-muted", text: "Loading automation rules…" }); try {