generated from nhcarrigan/template
fix: silently reload on ChunkLoadError after deployments
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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user