Skip to content

Commit

Permalink
check for isReady changes
Browse files Browse the repository at this point in the history
  • Loading branch information
shuding committed Jul 7, 2022
1 parent d1ff7eb commit 78663a9
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions packages/next/shared/lib/router/router.ts
Expand Up @@ -984,6 +984,7 @@ export default class Router implements BaseRouter {
// for static pages with query params in the URL we delay
// marking the router ready until after the query is updated
// or a navigation has occurred
const readyStateChange = this.isReady !== true
this.isReady = true
const isSsr = this.isSsr

Expand Down Expand Up @@ -1121,7 +1122,7 @@ export default class Router implements BaseRouter {
)
this._inFlightRoute = as

let localeChange = prevLocale !== nextState.locale
const localeChange = prevLocale !== nextState.locale

// If the url change is only related to a hash change
// We should not proceed. We should only change the state.
Expand Down Expand Up @@ -1496,7 +1497,9 @@ export default class Router implements BaseRouter {
const canSkipUpdating =
(options as any)._h &&
!upcomingScrollState &&
compareRouterStates(upcomingRouterState, this.state)
compareRouterStates(upcomingRouterState, this.state) &&
!readyStateChange &&
!localeChange

if (!canSkipUpdating) {
await this.set(
Expand Down

0 comments on commit 78663a9

Please sign in to comment.