Skip to content

Changing hash in URL causes getInitialProps to be re-fired #2825

@ldthorne

Description

@ldthorne

Changing the hash in the URL causes getInitialProps to be fired, which I think should've been fixed in this PR. See the following example repo: https://github.com/ldthorne/nextjs-back-reproduction.

  • I have searched the issues of this repository and believe that this is not a duplicate.

Expected Behavior

If the user clicks the go somewhere link that leads to an anchor -- which will add a hash to the url -- and then clicks the back button, getInitialProps should not be called.

Current Behavior

If the user clicks the go somewhere link that leads to an anchor -- which will add a hash to the url -- and then clicks the back button, getInitialProps is called.

Steps to Reproduce (for bugs)

  1. Clone repo: https://github.com/ldthorne/nextjs-back-reproduction.
  2. yarn.
  3. Open dev tools.
  4. Click the go somewhere link. Notice that nothing is logged.
  5. Click the browser's back button. Notice that getInitialProps is logged.

Your Environment

Tech Version
next 3.0.6
node 8.1.2
OS macOS 10.12.6
browser All

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions