Skip to content

chrome: nav hash duplicates on repeated click → reload → click #116

@yigitdot

Description

@yigitdot

Summary

Clicking the DecDN Labs wordmark or any in-nav section link, hard-reloading the page, and then clicking the same link again leaves the URL with a duplicated fragment — e.g. decdn.org/#method#method#method#method after a few cycles. Repeating the click → reload → click loop keeps appending. The fragment is invalid (browsers only recognise the first #), the page no longer scrolls to the intended section on subsequent loads, and the URL is unshareable.

Repro

  1. Open https://decdn.org/.
  2. Click the DecDN Labs wordmark, or any section link in the nav (e.g. "method").
  3. URL becomes decdn.org/#method. ✓
  4. Hard-reload (Cmd+R / Ctrl+R).
  5. Click the same link again.
  6. Observe: URL becomes decdn.org/#method#method. Repeat to grow further (#method#method#method#method, …).

Expected

URL stays decdn.org/#method. Clicking a same-hash link should be a no-op for the URL (and at most re-trigger the scroll to the section).

Affected

Desktop Next.js <Link> path in components/site/Chrome.tsx:

  • Wordmark — Chrome.tsx:148-174 (<Link href=\"/#intro\">).
  • Section list — Chrome.tsx:176-192 (<Link href={\/#${item.id}`}>`).

These are plain next/link Links with no onClick interception. The mobile drawer goes through MobileMenu.handleClick + history.replaceState(null, \"\", \#${anchor}`) (MobileMenu.tsx:236, 269-276`) and appears unaffected — worth confirming during triage.

Environment

  • next@16.2.6, react@19.2.6.
  • next.config.ts: output: \"export\", trailingSlash: true.
  • Reproduced on the deployed site (Cloudflare Pages serving out/).

Hypothesis / open questions

Repeated <Link href=\"/#method\"> clicks while the URL already carries #method appear to append the hash rather than replace it — consistent with an App Router hash-navigation quirk under output: \"export\" + trailingSlash: true. Could be a Next.js 16 bug or a local interaction; needs a clean repro to determine which.

Suggested next steps

  • Reduce to a minimal Next 16 repro outside this project to determine upstream vs. local.
  • If local: intercept these Link clicks (or wrap them) to detect same-hash navigation and fall back to history.replaceState + smooth scroll, similar to the helper in MobileMenu.tsx:55-91 — that scroll routine is already a good reuse target.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions