Merge pull request #1621 from Runfusion/fix/dashboard-refresh-loop-pr
fix: stop dashboard refresh loops
This commit is contained in:
5
.changeset/fn-blank-page-service-worker-assets.md
Normal file
5
.changeset/fn-blank-page-service-worker-assets.md
Normal 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.
|
||||
@@ -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";');
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
const CACHE_NAME = "fusion-cache-v4";
|
||||
const CACHE_NAME = "fusion-cache-v5";
|
||||
const APP_SHELL_URLS = [
|
||||
"/",
|
||||
"/index.html",
|
||||
|
||||
@@ -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}`);
|
||||
|
||||
Reference in New Issue
Block a user