nextjs - ✅(Solved) Fix 16.2.0-canary.60 breaks Back button after router.push [1 pull requests, 1 comments, 2 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
vercel/next.js#90513Fetched 2026-04-08 00:20:02
View on GitHub
Comments
1
Participants
2
Timeline
9
Reactions
0
Author
Timeline (top)
labeled ×2referenced ×2closed ×1commented ×1

Fix Action

Fixed

PR fix notes

PR #90533: Fix: server-patch retry preserves push/replace intent of suspended transitions

Description (problem / solution / changelog)

When a navigation triggers a server-patch retry (due to a route tree mismatch), the retry was unconditionally using navigateType='replace'. This assumed the original navigation had already committed to the browser history. But if the original transition was still suspended, pushState never ran, so replaceState overwrote the initial history entry instead of creating a new one, breaking the back button.

The fix tracks the last committed router tree. When a server-patch retry fires, it checks whether the original navigation has committed. If not, it inherits the original transition's push/replace intent instead of forcing 'replace'. This works because React entangles the retry with the original pending transition — they commit together.

Fixes #90513

Changed files

  • packages/next/src/client/components/app-router.tsx (modified, +3/-0)
  • packages/next/src/client/components/router-reducer/ppr-navigations.ts (modified, +39/-6)
  • packages/next/src/client/components/router-reducer/reducers/committed-state.ts (added, +23/-0)
  • packages/next/src/client/components/router-reducer/reducers/restore-reducer.ts (modified, +3/-1)
  • packages/next/src/client/components/router-reducer/reducers/server-patch-reducer.ts (modified, +1/-2)
  • packages/next/src/client/components/router-reducer/router-reducer-types.ts (modified, +1/-0)
  • packages/next/src/client/components/segment-cache/navigation.ts (modified, +2/-1)
  • test/e2e/app-dir/concurrent-navigations/app/push-search-params/page.tsx (added, +13/-0)
  • test/e2e/app-dir/concurrent-navigations/app/push-search-params/push-button.tsx (added, +15/-0)
  • test/e2e/app-dir/concurrent-navigations/server-patch-history.test.ts (added, +48/-0)

Code Example

Operating System:
  Platform: darwin
  Arch: arm64
  Version: Darwin Kernel Version 24.6.0: Mon Jan 19 22:01:58 PST 2026; root:xnu-11417.140.69.708.3~1/RELEASE_ARM64_T6041
  Available memory (MB): 131072
  Available CPU cores: 16
Binaries:
  Node: 24.11.0
  npm: 11.6.2
  Yarn: 1.22.22
  pnpm: 10.27.0
Relevant Packages:
  next: 16.2.0-canary.60 // There is a newer canary version (16.2.0-canary.61) available, please upgrade! 
  eslint-config-next: N/A
  react: 19.2.3
  react-dom: 19.2.3
  typescript: 5.9.3
Next.js Config:
  output: N/A
There is a newer canary version (16.2.0-canary.61) available, please upgrade! 
   Please try the latest canary version (`npm install next@canary`) to confirm the issue still exists before creating a new issue.
   Read more - https://nextjs.org/docs/messages/opening-an-issue
RAW_BUFFERClick to expand / collapse

Link to the code that reproduces this issue

https://github.com/franky47/next-repro-16.2.0-canary.60

To Reproduce

  1. Install dependencies (pnpm install)
  2. Build for production (next build)
  3. Start the server (next start)
  4. Open http://localhost:3000
  5. Follow the instructions on the page: a. Click the button which calls router.push('/?test=pass') b. Use the Back button to navigate back to / c. Note that we landed on the browser's "new tab" page instead
  6. Compare with [email protected], where navigation is correct

Current vs. Expected behavior

After a call to router.push to the same pathname (but with search params), I expect the Back button to land back to that same pathname prior to the application of the search params. Instead, it navigates to the previous history entry ("new tab" if starting from a fresh session).

Provide environment information

Operating System:
  Platform: darwin
  Arch: arm64
  Version: Darwin Kernel Version 24.6.0: Mon Jan 19 22:01:58 PST 2026; root:xnu-11417.140.69.708.3~1/RELEASE_ARM64_T6041
  Available memory (MB): 131072
  Available CPU cores: 16
Binaries:
  Node: 24.11.0
  npm: 11.6.2
  Yarn: 1.22.22
  pnpm: 10.27.0
Relevant Packages:
  next: 16.2.0-canary.60 // There is a newer canary version (16.2.0-canary.61) available, please upgrade! 
  eslint-config-next: N/A
  react: 19.2.3
  react-dom: 19.2.3
  typescript: 5.9.3
Next.js Config:
  output: N/A
⚠ There is a newer canary version (16.2.0-canary.61) available, please upgrade! 
   Please try the latest canary version (`npm install next@canary`) to confirm the issue still exists before creating a new issue.
   Read more - https://nextjs.org/docs/messages/opening-an-issue

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

Linking and Navigating

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

next build (local)

Additional context

The issue only started occurring since [email protected], and only in production mode (dev mode navigates back to the expected URL).

Tested in Firefox 148 & Chrome 145 on macOS 15.7.4.

Could be related to #90400.

extent analysis

Fix Plan

Upgrade to Next.js Canary Version

The issue is likely due to a bug in Next.js version 16.2.0-canary.60. To fix the issue, upgrade to the latest canary version of Next.js.

Step-by-Step Solution

  1. Run the following command to upgrade to the latest canary version:

npm install next@canary

2. Update your `package.json` file to use the new version of Next.js:
   ```json
"scripts": {
  "build": "next build",
  "start": "next start"
},
"dependencies": {
  "next": "^16.2.0-canary.61"
}
  1. Run npm install to install the new version of Next.js.
  2. Run next build and next start to rebuild and restart the server.

Verify the Fix

  1. Open http://localhost:3000 in your browser.
  2. Click the button which calls router.push('/?test=pass').
  3. Use the Back button to navigate back to /.
  4. Verify that you landed back on the correct URL instead of the browser's "new tab" page.

Extra Tips

  • Make sure to test the fix in both production and development modes.
  • If you're still experiencing issues, try downgrading to the previous version of Next.js (16.2.0-canary.59) to confirm that the issue is fixed in the newer version.
  • Keep an eye on the Next.js changelog and issue tracker for updates on this bug.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

nextjs - ✅(Solved) Fix 16.2.0-canary.60 breaks Back button after router.push [1 pull requests, 1 comments, 2 participants]