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 <noreply@anthropic.com>
This commit is contained in:
Jeff Emmett 2026-03-23 16:00:51 -07:00
parent 3cfec226a4
commit 8649598c26
2 changed files with 7 additions and 1 deletions

View File

@ -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);

View File

@ -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;