fix: force refresh on chunk preload error (#7600)

* fix: force refresh on preload error

* misc: add comment

* Update PendingNavigation.tsx
This commit is contained in:
Yangshun Tay 2022-06-11 17:03:11 +08:00 committed by GitHub
parent ec8230b7ba
commit feb9cf01ed
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -70,7 +70,13 @@ class PendingNavigation extends React.Component<Props, State> {
this.routeUpdateCleanupCb();
this.setState({nextRouteHasLoaded: true});
})
.catch((e: unknown) => console.warn(e));
.catch((e: unknown) => {
console.warn(e);
// If chunk loading failed, it could be because the path to a chunk
// no longer exists due to a new deployment. Force refresh the page
// instead of just not navigating.
window.location.reload();
});
return false;
}