Skip to content

Commit

Permalink
fix: force refresh on chunk preload error (#7600)
Browse files Browse the repository at this point in the history
* fix: force refresh on preload error

* misc: add comment

* Update PendingNavigation.tsx
  • Loading branch information
yangshun committed Jun 11, 2022
1 parent ec8230b commit feb9cf0
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion packages/docusaurus/src/client/PendingNavigation.tsx
Expand Up @@ -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;
}

Expand Down

0 comments on commit feb9cf0

Please sign in to comment.