F: Reload when failed to load stale module
This commit is contained in:
parent
5928d79acb
commit
9f03b00818
|
|
@ -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(
|
createRoot(document.getElementById('root')!).render(
|
||||||
<GlobalProviders>
|
<GlobalProviders>
|
||||||
<App />
|
<App />
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user