vercel/next.js

Router asPath doesn't match between SSR and CSR

LineGu opened this issue · 2 comments

LineGu commented

Link to the code that reproduces this issue

https://github.com/LineGu/next-issue-reproduction

To Reproduce

  1. Run yarn dev
  2. navigate to /auto-export?query=true
  3. See error

Current vs. Expected behavior

When navigating to an auto-export page with a query string, the query string information is included in the asPath during the hydration phase. It causing a mismatch between the SSR and CSR.

image

Provide environment information

Operating System:
  Platform: darwin
  Arch: arm64
  Version: Darwin Kernel Version 23.3.0: Thu Dec 21 02:29:41 PST 2023; root:xnu-10002.81.5~11/RELEASE_ARM64_T8122
  Available memory (MB): 16384
  Available CPU cores: 8
Binaries:
  Node: 20.15.0
  npm: 10.7.0
  Yarn: 1.22.22
  pnpm: 9.6.0
Relevant Packages:
  next: 15.1.0 // Latest available version is detected (15.1.0).
  eslint-config-next: 15.1.0
  react: 19.0.0
  react-dom: 19.0.0
  typescript: 5.7.2
Next.js Config:
  output: N/A

Which area(s) are affected? (Select all that apply)

Pages Router

Which stage(s) are affected? (Select all that apply)

next dev (local), next start (local), Vercel (Deployed), Other (Deployed)

Additional context

similar issue to #8660