Skip to content

Commit

Permalink
Remove unused error (vercel#15748)
Browse files Browse the repository at this point in the history
Irrelevant since vercel#15379
  • Loading branch information
Janpot authored Jul 31, 2020
1 parent b3c9737 commit ad5c736
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 10 deletions.
6 changes: 3 additions & 3 deletions errors/popstate-state-empty.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@

#### Why This Error Occurred

When using the browser back button the popstate event is triggered. Next.js sets
`popstate` event triggered but `event.state` did not have `url` or `as`, causing a route change failure
When using the browser back button the popstate event is triggered. Next.js sees a
`popstate` event being triggered but `event.state` did not have `url` or `as`, causing a route change failure.

#### Possible Ways to Fix It

The only known cause of this issue is manually manipulating `window.history` instead of using `next/router`
The only known cause of this issue is manually manipulating `window.history` instead of using `next/router`. Starting from version 9.5, Next.js will ignore `popstate` events that contain `event.state` not created by its own router.

### Useful Links

Expand Down
7 changes: 0 additions & 7 deletions packages/next/next-server/lib/router/router.ts
Original file line number Diff line number Diff line change
Expand Up @@ -360,13 +360,6 @@ export default class Router implements BaseRouter {
return
}

if (process.env.NODE_ENV !== 'production') {
if (typeof url === 'undefined' || typeof as === 'undefined') {
console.warn(
'`popstate` event triggered but `event.state` did not have `url` or `as` https://err.sh/vercel/next.js/popstate-state-empty'
)
}
}
this.change('replaceState', url, as, options)
}

Expand Down

0 comments on commit ad5c736

Please sign in to comment.