refactor(core): lower timeout before rendering progress bar to 200ms (#7142)

This commit is contained in:
Joshua Chen 2022-04-09 20:19:17 +08:00 committed by GitHub
parent 0dc7f0ff14
commit b50def3ac0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 4 deletions

View file

@ -38,7 +38,7 @@ export default function App(): JSX.Element {
<BaseUrlIssueBanner />
<PendingNavigation
location={normalizeLocation(location)}
delay={1000}>
delay={200}>
{routeElement}
</PendingNavigation>
</Root>

View file

@ -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)
@ -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() {