fix: silently reload on ChunkLoadError after deployments
Node.js CI / CI (pull_request) Successful in 1m47s
Security Scan and Upload / Security & DefectDojo Upload (pull_request) Successful in 1m53s

Stale chunk errors occur when a user has an old version of the app cached
after a redeployment. Detect ChunkLoadError before logging so the page
reloads automatically without showing a toast or sending noise to the API.
This commit is contained in:
2026-02-23 20:11:46 -08:00
committed by Naomi Carrigan
parent b81b77ac2f
commit e8610667b5
@@ -12,6 +12,11 @@ export class GlobalErrorHandler implements ErrorHandler {
private toast = inject(ToastService);
handleError(error: Error): void {
if (error.name === 'ChunkLoadError' || error.message.includes('Loading chunk')) {
window.location.reload();
return;
}
console.error('Global error caught:', error);
// Show user-friendly error message