diff --git a/web/hwlab-cloud-web/scripts/r6-architecture-parity.test.ts b/web/hwlab-cloud-web/scripts/r6-architecture-parity.test.ts index 1a74fe4e..5b69fa5f 100644 --- a/web/hwlab-cloud-web/scripts/r6-architecture-parity.test.ts +++ b/web/hwlab-cloud-web/scripts/r6-architecture-parity.test.ts @@ -15,6 +15,7 @@ test("R6 route meta title and chunk recovery match Sub2API navigation pattern", assert.equal(resolveDocumentTitle(" "), "平台控制台 - HWLAB Cloud Web"); assert.equal(isChunkLoadError(new Error("Failed to fetch dynamically imported module")), true); assert.equal(isChunkLoadError(new Error("Loading CSS chunk 42 failed")), true); + assert.equal(isChunkLoadError(new Error("Unable to preload CSS for /assets/MdtodoView.css")), true); assert.equal(isChunkLoadError(new Error("ordinary route guard failure")), false); const memory = new Map(); diff --git a/web/hwlab-cloud-web/src/router/guards.ts b/web/hwlab-cloud-web/src/router/guards.ts index a12c9da6..8334fd11 100644 --- a/web/hwlab-cloud-web/src/router/guards.ts +++ b/web/hwlab-cloud-web/src/router/guards.ts @@ -8,7 +8,7 @@ const CHUNK_RELOAD_WINDOW_MS = 10_000; export function isChunkLoadError(error: unknown): boolean { const message = error instanceof Error ? error.message : String(error ?? ""); - return /Loading chunk|Loading CSS chunk|Failed to fetch dynamically imported module|Importing a module script failed|dynamically imported module/u.test(message); + return /Loading chunk|Loading CSS chunk|Unable to preload CSS|Failed to fetch dynamically imported module|Importing a module script failed|dynamically imported module/u.test(message); } export function shouldReloadForChunkError(now = Date.now(), storage: Pick = window.sessionStorage): boolean {