From 4b855f18bffe1e51b160c548bd5e0ac03cb24211 Mon Sep 17 00:00:00 2001 From: Raghav Chari Date: Mon, 17 Aug 2026 20:05:53 +0000 Subject: [PATCH] fix(deck): guard route-info blank after revert (381) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Rolling back a message could post an empty/path-length-1 route-info that blanked the pane — tab.url became '' and the iframe reloaded to a blank sessions page with the rolled-back dock stuck (it kept resetting collapsed due to items length churn). Upstream opencode#210 fixes the dock's collapse logic and adds a placeholder for all-rolled-back timeline; this deck guard prevents a bad route-info from ever clearing a valid tab URL. Fixes https://github.com/harmoniqs/amicode/issues/381 Upstream: harmoniqs/opencode#210 --- packages/extension/src/deck/shell.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/packages/extension/src/deck/shell.ts b/packages/extension/src/deck/shell.ts index b5566e9f..f0f79f69 100644 --- a/packages/extension/src/deck/shell.ts +++ b/packages/extension/src/deck/shell.ts @@ -434,8 +434,11 @@ window.addEventListener("message", (e) => { // route-info (fork bridge): live label + current route for future rebuilds. // Adopt paths only — never absolute URLs (an injected message must not be // able to point a pane at an arbitrary origin). + // Fix #381: a revert that leaves path empty/undefined previously blanked the + // pane (tab.url → "" → iframe src without route); guard so blank sessions + // never overwrite a valid URL and the rolled-back dock remains dismissible. if (d.kind === "route-info" && typeof d.path === "string" && tabId) { - const safe = d.path.startsWith("/") && !d.path.startsWith("//") ? d.path : undefined; + const safe = d.path.startsWith("/") && !d.path.startsWith("//") && d.path.length > 1 ? d.path : undefined; let changed = false; if (safe) { for (const g of deck.groups) {