mirror of
https://github.com/facebook/docusaurus.git
synced 2025-06-09 14:22:27 +02:00
refactor(core): lower timeout before rendering progress bar to 200ms (#7142)
This commit is contained in:
parent
0dc7f0ff14
commit
b50def3ac0
2 changed files with 4 additions and 4 deletions
|
@ -38,7 +38,7 @@ export default function App(): JSX.Element {
|
||||||
<BaseUrlIssueBanner />
|
<BaseUrlIssueBanner />
|
||||||
<PendingNavigation
|
<PendingNavigation
|
||||||
location={normalizeLocation(location)}
|
location={normalizeLocation(location)}
|
||||||
delay={1000}>
|
delay={200}>
|
||||||
{routeElement}
|
{routeElement}
|
||||||
</PendingNavigation>
|
</PendingNavigation>
|
||||||
</Root>
|
</Root>
|
||||||
|
|
|
@ -56,7 +56,7 @@ class PendingNavigation extends React.Component<Props, State> {
|
||||||
// Save the location first.
|
// Save the location first.
|
||||||
this.previousLocation = this.props.location;
|
this.previousLocation = this.props.location;
|
||||||
this.setState({nextRouteHasLoaded: false});
|
this.setState({nextRouteHasLoaded: false});
|
||||||
this.startProgressBar(this.props.delay);
|
this.startProgressBar();
|
||||||
|
|
||||||
// Load data while the old screen remains.
|
// Load data while the old screen remains.
|
||||||
preload(nextLocation.pathname)
|
preload(nextLocation.pathname)
|
||||||
|
@ -86,14 +86,14 @@ class PendingNavigation extends React.Component<Props, State> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private startProgressBar(delay: number) {
|
private startProgressBar() {
|
||||||
this.clearProgressBarTimeout();
|
this.clearProgressBarTimeout();
|
||||||
this.progressBarTimeout = window.setTimeout(() => {
|
this.progressBarTimeout = window.setTimeout(() => {
|
||||||
clientLifecyclesDispatcher.onRouteUpdateDelayed({
|
clientLifecyclesDispatcher.onRouteUpdateDelayed({
|
||||||
location: this.props.location,
|
location: this.props.location,
|
||||||
});
|
});
|
||||||
nprogress.start();
|
nprogress.start();
|
||||||
}, delay);
|
}, this.props.delay);
|
||||||
}
|
}
|
||||||
|
|
||||||
private stopProgressBar() {
|
private stopProgressBar() {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue