mirror of
https://github.com/facebook/docusaurus.git
synced 2025-06-03 03:12:35 +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 />
|
||||
<PendingNavigation
|
||||
location={normalizeLocation(location)}
|
||||
delay={1000}>
|
||||
delay={200}>
|
||||
{routeElement}
|
||||
</PendingNavigation>
|
||||
</Root>
|
||||
|
|
|
@ -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() {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue