Merge pull request #1621 from Runfusion/fix/dashboard-refresh-loop-pr

fix: stop dashboard refresh loops
This commit is contained in:
gsxdsm
2026-06-21 00:25:48 -07:00
committed by GitHub
4 changed files with 10 additions and 4 deletions

View File

@@ -0,0 +1,5 @@
---
"@runfusion/fusion": patch
---
Revalidate dashboard service-worker assets before falling back to cache so rebuilt tabs cannot stay on stale bundles and render a blank page.

View File

@@ -194,7 +194,7 @@ describe("PWA configuration", () => {
expect(swSource).toContain('addEventListener("install"');
expect(swSource).toContain('addEventListener("fetch"');
expect(swSource).toContain('addEventListener("activate"');
expect(swSource).toContain('const CACHE_NAME = "fusion-cache-v4";');
expect(swSource).toContain('const CACHE_NAME = "fusion-cache-v5";');
});
it("service worker bypasses SSE requests instead of trying to cache them", () => {
@@ -316,7 +316,7 @@ describe("PWA configuration", () => {
expect(indexHtml).toContain('<link rel="icon" type="image/svg+xml" href="/logo.svg" />');
expect(indexHtml).toContain('<link rel="apple-touch-icon" href="/icons/icon-192.png" />');
expect(swSource).toContain('const CACHE_NAME = "fusion-cache-v4";');
expect(swSource).toContain('const CACHE_NAME = "fusion-cache-v5";');
});
});
});

View File

@@ -1,4 +1,4 @@
const CACHE_NAME = "fusion-cache-v4";
const CACHE_NAME = "fusion-cache-v5";
const APP_SHELL_URLS = [
"/",
"/index.html",

View File

@@ -240,7 +240,8 @@ export async function checkVersion(trigger: VersionCheckTrigger = "initial"): Pr
} catch {
// ignore
}
if (autoReloadEnabled) {
const alreadyAttempted = Boolean((() => { try { return sessionStorage.getItem(RELOAD_FLAG); } catch { return null; } })());
if (autoReloadEnabled && !alreadyAttempted) {
setReloadedRemoteVersion(remote);
}
reloadOnce(`build version changed: ${__BUILD_VERSION__} -> ${remote}`);