:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
fix(frontend): recognize Firefox chunk-load failures on stale deploys (#58245)
posthog[bot]f41c55b2f7a5
diff --git a/frontend/src/lib/utils/isChunkLoadError.test.ts b/frontend/src/lib/utils/isChunkLoadError.test.tsindex b52cf1978243..665479cce8a7 100644--- a/frontend/src/lib/utils/isChunkLoadError.test.ts+++ b/frontend/src/lib/utils/isChunkLoadError.test.ts@@ -9,6 +9,11 @@ describe('isChunkLoadError', () => {true,],['Safari native TypeError: Load failed', { name: 'TypeError', message: 'Load failed' }, true],+ [+ 'Firefox native TypeError: NetworkError',+ { name: 'TypeError', message: 'NetworkError when attempting to fetch resource.' },+ true,+ ],['generic TypeError', { name: 'TypeError', message: 'undefined is not a function' }, false],['unrelated Error', { name: 'Error', message: 'something else' }, false],['error with no name or message', {}, false],diff --git a/frontend/src/lib/utils/isChunkLoadError.ts b/frontend/src/lib/utils/isChunkLoadError.tsindex 800297b4b9fd..d1ed2eb94cbb 100644--- a/frontend/src/lib/utils/isChunkLoadError.ts+++ b/frontend/src/lib/utils/isChunkLoadError.ts@@ -3,6 +3,7 @@* - webpack: `Error` with `name === 'ChunkLoadError'`* - esbuild/Vite: message contains `'Failed to fetch dynamically imported module'`* - Safari: native `TypeError: Load failed` (no JS stack — see load-failed.tsx known exception)+ * - Firefox: native `TypeError: NetworkError when attempting to fetch resource.`*/export function isChunkLoadError(error: unknown): boolean {if (!error || typeof error !== 'object') {@@ -10,9 +11,11 @@ export function isChunkLoadError(error: unknown): boolean {}const err = error as { name?: string; message?: string }const message = typeof err.message === 'string' ? err.message : ''+ const isTypeError = err.name === 'TypeError'return (err.name === 'ChunkLoadError' ||message.includes('Failed to fetch dynamically imported module') ||- (err.name === 'TypeError' && message.includes('Load failed'))+ (isTypeError && message.includes('Load failed')) ||+ (isTypeError && message.includes('NetworkError when attempting to fetch resource')))}