Skip to content

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

1 Commit

Folders and files

Repository files navigation

Next Link Hash Repro

Minimal standalone Next.js app for checking hash-handling behavior with the same framework versions used by the docs app:

  • next: 16.2.6
  • react: 19.2.4
  • react-dom: 19.2.4

Install

cd /Users/timonreyturak/Documents/GitHub/next-link-hash-repro
npm install

Run in dev mode

npm run dev

Open:

  • http://localhost:3100/#section-a

Run in production mode locally

npm run build
npm run start

Open:

  • http://localhost:3100/#section-a

Repro checks

Check 1: same-page hash replacement

  1. Open /#section-a directly.
  2. Click Next hash link to section B.
  3. Watch the URL debugger and the browser URL.

Expected healthy behavior:

  • URL becomes /#section-b
  • event log should show either a single hashchange or a single pushState/replaceState to the new fragment, but not a doubled fragment

Check 2: stale fragment during page navigation

  1. Open /#section-a directly.
  2. Click Go to other page with Next pathname string.
  3. Click Back home with Next pathname string.
  4. Repeat with Next pathname object.

Expected healthy behavior:

  • returning to / should not silently restore #section-a unless the clicked link explicitly includes that hash

Why this app exists

The docs app reproduces the issue only in deployed production Chromium right now. This app isolates next/link from the docs codebase so you can compare:

  • next dev
  • next build && next start
  • local versus deployed environments
  • next/link versus native anchor behavior

Current local result

Observed locally on 6 July 2026 in Chromium with this minimal app:

  • npm run dev: no duplicate fragment and no stale fragment restoration in the tested flows
  • npm run build && npm run start: next/link reproduces both issues
    • starting at /#section-a, clicking Next hash link to section B produces /#section-a#section-b
    • starting at /#section-a, going to /other with next/link and returning with next/link restores /#section-a
  • native anchors remain healthy in the same local production run
    • Native hash link to section B becomes /#section-b
    • native navigation back to / returns / without restoring the stale fragment

Publish checklist

Use this before sharing the repro outside your machine.

  1. Initialize a standalone git repo in /Users/timonreyturak/Documents/GitHub/next-link-hash-repro.
  2. Replace absolute local paths in documentation with a public repository URL.
  3. Confirm README.md only references npm install, npm run dev, npm run build, and npm run start.
  4. Run npm install from a clean checkout to ensure package-lock.json is valid.
  5. Run npm run build and npm run start, then repeat both repro flows once more.
  6. Capture one screenshot or screen recording of /#section-a#section-b in production mode.
  7. Paste the contents of NEXT_ISSUE_GITHUB.md into the upstream Next.js issue.
  8. Link the public repro repository in the issue body.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages