Skip to content

Commit

Permalink
refactor(core): lower timeout before rendering progress bar to 200ms (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
Josh-Cena authored Apr 9, 2022
1 parent 0dc7f0f commit b50def3
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion packages/docusaurus/src/client/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export default function App(): JSX.Element {
<BaseUrlIssueBanner />
<PendingNavigation
location={normalizeLocation(location)}
delay={1000}>
delay={200}>
{routeElement}
</PendingNavigation>
</Root>
Expand Down
6 changes: 3 additions & 3 deletions packages/docusaurus/src/client/PendingNavigation.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ class PendingNavigation extends React.Component<Props, State> {
// Save the location first.
this.previousLocation = this.props.location;
this.setState({nextRouteHasLoaded: false});
this.startProgressBar(this.props.delay);
this.startProgressBar();

// Load data while the old screen remains.
preload(nextLocation.pathname)
Expand Down Expand Up @@ -86,14 +86,14 @@ class PendingNavigation extends React.Component<Props, State> {
}
}

private startProgressBar(delay: number) {
private startProgressBar() {
this.clearProgressBarTimeout();
this.progressBarTimeout = window.setTimeout(() => {
clientLifecyclesDispatcher.onRouteUpdateDelayed({
location: this.props.location,
});
nprogress.start();
}, delay);
}, this.props.delay);
}

private stopProgressBar() {
Expand Down

0 comments on commit b50def3

Please sign in to comment.