From 8649598c267f6c0f6345df2bb41e983c1d970ae4 Mon Sep 17 00:00:00 2001 From: Jeff Emmett Date: Mon, 23 Mar 2026 16:00:51 -0700 Subject: [PATCH] fix(tab-cache): add Accept header so tab fetch works on private spaces The TabCache fetchAndInject() was sending fetch() without Accept: text/html, causing the server to treat it as an API request and return 401 on private spaces. Also adds .catch() fallbacks to shell tab handlers for resilience. Co-Authored-By: Claude Opus 4.6 --- server/shell.ts | 4 ++++ shared/tab-cache.ts | 4 +++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/server/shell.ts b/server/shell.ts index 0fdde38..022b414 100644 --- a/server/shell.ts +++ b/server/shell.ts @@ -935,6 +935,8 @@ export function renderShell(opts: ShellOptions): string { } else { window.location.href = window.__rspaceNavUrl(spaceSlug, moduleId); } + }).catch(() => { + window.location.href = window.__rspaceNavUrl(spaceSlug, moduleId); }); } else { window.location.href = window.__rspaceNavUrl(spaceSlug, moduleId); @@ -956,6 +958,8 @@ export function renderShell(opts: ShellOptions): string { } else { window.location.href = window.__rspaceNavUrl(spaceSlug, moduleId); } + }).catch(() => { + window.location.href = window.__rspaceNavUrl(spaceSlug, moduleId); }); } else { window.location.href = window.__rspaceNavUrl(spaceSlug, moduleId); diff --git a/shared/tab-cache.ts b/shared/tab-cache.ts index 23f37ce..1c89977 100644 --- a/shared/tab-cache.ts +++ b/shared/tab-cache.ts @@ -192,7 +192,9 @@ export class TabCache { app.appendChild(loadingPane); try { - const resp = await fetch(fetchUrl); + const resp = await fetch(fetchUrl, { + headers: { "Accept": "text/html" }, + }); if (!resp.ok) { loadingPane.remove(); return false;