mirror of
https://github.com/IRBorisov/ConceptPortal.git
synced 2025-11-15 17:21:38 +03:00
F: Reload when failed to load stale module
This commit is contained in:
parent
0904aed260
commit
20af4666cf
|
|
@ -13,6 +13,18 @@ if (typeof window !== 'undefined' && !!process.env.NODE_ENV && process.env.NODE_
|
|||
);
|
||||
}
|
||||
|
||||
window.addEventListener('error', (event: ErrorEvent) => {
|
||||
const error = event.error as Error;
|
||||
if (
|
||||
error instanceof Error &&
|
||||
typeof error.message === 'string' &&
|
||||
error.message.includes('Failed to fetch dynamically imported module')
|
||||
) {
|
||||
console.warn('Detected stale bundle — reloading...');
|
||||
window.location.reload();
|
||||
}
|
||||
});
|
||||
|
||||
createRoot(document.getElementById('root')!).render(
|
||||
<GlobalProviders>
|
||||
<App />
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user