You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Next 16.2 router cache issue, if search param name is used multiple times #92152
Current behavior: I don't see the Suspense fallback, the list doesn't show the state correctly
Expected behavior: After deselecting "green", I want to see "loading..." immediately and the correct list after 1500ms
Provide environment information
Operating System:
Platform: darwin
Arch: arm64
Version: Darwin Kernel Version 25.3.0: Wed Jan 28 20:51:28 PST 2026; root:xnu-12377.91.3~2/RELEASE_ARM64_T6041
Available memory (MB): 65536
Available CPU cores: 16
Binaries:
Node: 24.11.0
npm: 11.8.0
Yarn: 1.22.22
pnpm: 10.33.0
Relevant Packages:
next: 16.2.1 // Latest available version is detected (16.2.1).
eslint-config-next: N/A
react: 19.2.3
react-dom: 19.2.3
typescript: 5.9.3
Next.js Config:
output: N/A
Which area(s) are affected? (Select all that apply)
Linking and Navigating
Which stage(s) are affected? (Select all that apply)
next dev (local), next start (local)
Additional context
In our application we're following this guide to provide a page with filtering options. This used to work very well, but since we updated next to 16.2.x we run into the same issue that you can reproduce from the given repository
Reacted by Ravi Asnani, Mikko Tirronen, Rami Ertimo, azu, ivailoiliev, Eduard Gert, Euclides do Rosário, Felix Shih, Ayodele Samuel Adebayo, Pierre Amelot and 6 more
Submitted a draft PR with a fix and a regression test: #93368.
Root cause: three client-side call sites built the page cache key with Object.fromEntries(new URLSearchParams(...)), which collapses repeated keys to the last value. The server uses a Record<string, string | string[]> and preserves arrays, so the cache key for ?color=red&color=green&color=blue and the one for ?color=red&color=blue both reduced to {"color":"blue"} on the client and shared the same entry — the stale render was served and Suspense never re-suspended.
Verified locally on the linked repro: 16.1.7 unaffected, 16.2.4 reproduces, canary plus the patch passes. The regression was introduced in #87256 (v16.2.0), which added a third place using this pattern; the other two have used it since v16.0 and are corrected together.
npm run build && npm start, open /listings, click the button.
URL bar does not change. Server Component does not re-run. No console error.
Network panel: a single GET /listings?regions=75&_rsc=... → 200 text/x-component → net::ERR_ABORTED mid-body.
next dev works correctly. Direct URL load works correctly. Navigating to a different pathname works correctly.
router.replace, <Link href="/listings?regions=75"> from /listings, and history.pushState + router.refresh() all fail the same way.
This is notregions=red®ions=green → regions=red®ions=blue (PR #93368's target). It's (no regions param) → regions=75. A single key, a single value, going from absent to present.
Trace (patched node_modules with console.error markers)
[navigateImpl] from=/listings to=/listings?regions=75
[navigateToKnownRoute] starting PPR isSamePage=false task=OK
[spawnDynamicRequests] fired
[fetchServerResponse] url=/listings?regions=75
[completeSoftNavigation] canonicalUrl=/listings?regions=75
[navigate-final] canonicalUrl=/listings?regions=75 sameAsInput=false
[action-handleResult] discarded=false nextCanonicalUrl=/listings?regions=75
[useActionQueue] isThenable=true (promise pending)
[flight-response-ok] contentType=text/x-component
[flight-resp-decoded] buildId matches
[flight-data-normalized-ok]
[useActionQueue AFTER-use] canonicalUrl=/listings?regions=75 <- resolved
[Router-render] canonicalUrl=/listings?regions=75 <- new state
[HistoryUpdater-render] canonicalUrl=/listings?regions=75 <- inside JSX
... renders repeat with the new state ...
*** [HistoryUpdater useInsertionEffect] never fires ***
The fetch succeeds, completeSoftNavigation returns a state with the correct canonicalUrl, the promise from useActionQueue resolves, React renders both Router and HistoryUpdater with the new canonicalUrl — but HistoryUpdater's useInsertionEffect (which calls window.history.pushState) never fires. The transition renders but never commits.
Hypothesis (please verify)
updateCacheNodeOnNavigation in ppr-navigations.js (around line 159):
if(oldCacheNode!==undefined&&!shouldRefreshDynamicData&&!(isLeafSegment&&isSamePageNavigation)){newCacheNode=reuseSharedCacheNode(dropPrefetchRsc,oldCacheNode);needsDynamicRequest=false;}else{// createCacheNodeForSegment with a fresh deferred RSC}
For same-pathname-different-query:
isSamePageNavigation is false (because the full URL differs).
Outer (layout) segments are reused with their already-resolved RSC.
The __PAGE__ leaf is recreated because matchSegment(newSegment, oldSegment) is false (the page segment's serialized identity includes the search params).
The resulting cache tree mixes reused-old-RSC parents with a freshly-created-deferred-RSC leaf. After writeDynamicDataIntoNavigationTask resolves the leaf's deferred promise, React 19's concurrent renderer keeps re-running the render but never commits — classic "transition starts and renders but commit is held back." This mirrors what reporter on #92152 sees and what we see; PR #93368's searchStringToRecord fix addresses one specific cause of the cache-key mismatch (repeated keys) but doesn't address the broader mixed reuse/new tree pattern that triggers on any single-value change.
Workarounds tested end-to-end (Puppeteer against real prod build)
We're shipping window.location.assign in our app to keep moving. Would love to remove it once a real fix lands. Happy to provide the full Puppeteer + patched-node_modules diagnostic scripts if useful.
Due to this issue, we are seeing significant incorrect behavior in our system and are forced to use workarounds with the refresh() function to solve the problem
@lorenzoedoardofrancesco
Thanks for the detailed report. I tried reproducing your single-value case (/listings → /listings?regions=75) on 16.2.6 with next build && next start, using a minimal setup without external dependencies like Prisma, but navigation worked correctly on my end.
Could you share a minimal reproduction repository with those dependencies removed? That would help us isolate whether this is a Next.js core issue or environment-specific.
PR #93368 targets the duplicate-key cache collision described in this issue, so the broader case you're describing may need a separate issue.
Stock create-next-app (Next 16.2.6, React 19.2.4, Node 24) plus three files: async Server Component at
/listings that reads ?regions and renders ?count=N fake rows in a table, a Client Component with
router.push buttons, and a loading.tsx. No Prisma, no NextAuth, no Tailwind, no fonts, no middleware.
One correction vs. the original issue text: in this minimal repro I didn't reproduce the exact 200
text/x-component then net::ERR_ABORTED mid-body Network signature I had against the real app. The
user-visible symptom is identical, but the network failure mode in the simpler scenario looks different.
Worth a closer look from your side.
Happy to open a new issue for this if you prefer, since you noted PR #93368's scope is the duplicate-key
case. Let me know which one you'd like me to follow up under.
I got the same problem, downgrading to 16.1 fixes it. I don't want to downgrade so for now using router.refresh works.
Using revalidePath in a server would also work but isn't idiomatic when used form client components since it needs to be async to be a server action wherease revalidePath isn't async at all.
For now using router.refresh() does the job but I hope to see a fix on the next version :)
Follow-up on my earlier single-value report (/listings -> /listings?regions=75 never committing in prod builds): root cause identified. It is not the router or the segment cache - it is the React canary that Next vendors in next/dist/compiled/react*.
TL;DR
The hang is react/react#35821 ("useDeferredValue getting stuck"), fixed upstream by react/react#36134 (merged 2026-03-24). The fix reached Next via the vendored React upgrade in #91905 (19.3.0-canary-8b2e903a-20260320 -> 19.3.0-canary-3cb2c420-20260324), first published in 16.2.1-canary.11. It was never backported to the 16.2 release branch: every 16.2.x stable up to and including 16.2.9 (published 2026-06-09) still vendors 19.3.0-canary-3f0b9e61-20260317, which predates the React fix. That is why the bug reproduces on all 16.2.x stables while the canary/16.3 line is unaffected since late March.
This explains the failure mode exactly: the navigation transition renders (Router and HistoryUpdater both re-render with the new canonicalUrl) but React never commits it, so HistoryUpdater's useInsertionEffect - which calls history.pushState - never fires. URL frozen, Server Component data never swapped in, no error anywhere.
Bisected the published canary ladder between 16.2.1 (broken) and 16.3.0-canary.0 (working): 16.2.1-canary.10 reproduces, 16.2.1-canary.11 is fixed. The commit range between the two builds (d529a233e8...2fe21375d9) contains 6 commits; the only one touching runtime code is the React upgrade Upgrade React from 8b2e903a-20260320 to 3cb2c420-20260324 #91905.
Grafted only the React files: copying dist/compiled/{react,react-dom,react-server-dom-*,scheduler}* from the 16.2.1-canary.11 package into an otherwise untouched 16.2.1-canary.10 install flips the repro from broken to fixed. Same graft onto stock 16.2.7: also fixed. No other file changes.
Instrumented the segment cache on 16.2.7 to rule the router out. For the failing navigation, updateCacheNodeOnNavigation correctly recreates the __PAGE__ leaf (__PAGE__ vs __PAGE__?{"regions":"75"}), the dynamic response matches every task segment, writeDynamicDataIntoNavigationTask fulfills all pending nodes, and finishNavigationTask exits with status 0 (no tree mismatch, no retry). The cache layer completes cleanly; the loss happens afterwards, inside React's commit.
Version matrix (all verified with the repro unless noted)
next
vendored React
result
16.2.1, 16.2.4, 16.2.6, 16.2.7 (stable)
19.3.0-canary-3f0b9e61-20260317
broken
16.2.9 (stable, 2026-06-09)
19.3.0-canary-3f0b9e61-20260317 (inspected, not e2e-tested)
The net::ERR_ABORTED on the _rsc fetch is a red herring: it shows up identically on the passing builds (it is the static-stage body-clone cancellation in fetch-server-response.ts), so it is not a useful signal for this bug.
Could the vendored React upgrade (#91905, or any later pin >= 3cb2c420-20260324) be backported to the 16.2 release branch? On 16.2.x stable, every same-pathname router.push/router.replace/<Link> navigation that only changes the query string silently fails in production - filters, sort headers, pagination - with no error and no console output, while dev mode works. Several commenters above are pinned on 16.2.x because of the CVE fixed there, so the practical alternatives today are downgrading to 16.1 or moving to the 16.3 preview line.
We are severely impacted by this as well, so we decided to build a local patch-package setup based on #93368.
We cannot wait anymore, the router.refresh() approach causes more problems than it solves.
This is great news. I was under the impression that it was not fixed in 16.3 and I was not able to test it myself yet, because we have a 14 days policy for package age. Will check it out as soon as possible.
Thank you for taking your time to write this, you really helped me!
Hi @transfer1992
Looks like this was fixed in #94863 (merged into canary, released in 16.3).
Upgrading to [email protected] or later should resolve this — as also confirmed by @juanfranciscocis above — without needing the router.refresh() workaround.
Thanks for the report and reproduction. This was fixed by #94863 and released in Next.js 16.3.0. I verified that 16.2.12 still reproduces the issue, while both next dev and next start work correctly on 16.3.3. Please upgrade to 16.3 or later.
This issue was closed by a maintainer. If you think it was closed by mistake, you can request that it be reopened within the next 14 days.
Reply with Reopen: <reason> and explain why the issue is still relevant. If you opened this issue or commented before it was closed, the issue will be reopened automatically.
After 14 days, please open a new issue with up-to-date details and a reproduction, when applicable.
This closed issue has been automatically locked because it had no new activity for 2 weeks. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you.
Activity
stephenhmarsh commentedon Apr 20, 2026
This bug is still present in 16.2.4.
I am temporarily working around it with a hacky call to
router.refresh()😐cc @Pebbletoe
stephenhmarsh commentedon Apr 21, 2026
Actually
router.refresh()was causing all analytics page events to be sent twice.My only fix is to roll back to 16.1, which I confirmed fixes this bug. So it's very real.
genie-ru commentedon Apr 29, 2026
Submitted a draft PR with a fix and a regression test: #93368.
Root cause: three client-side call sites built the page cache key with
Object.fromEntries(new URLSearchParams(...)), which collapses repeated keys to the last value. The server uses aRecord<string, string | string[]>and preserves arrays, so the cache key for?color=red&color=green&color=blueand the one for?color=red&color=blueboth reduced to{"color":"blue"}on the client and shared the same entry — the stale render was served and Suspense never re-suspended.Verified locally on the linked repro: 16.1.7 unaffected, 16.2.4 reproduces, canary plus the patch passes. The regression was introduced in #87256 (v16.2.0), which added a third place using this pattern; the other two have used it since v16.0 and are corrected together.
DevelopmentEsmarkFinch commentedon May 12, 2026
lorenzoedoardofrancesco commentedon May 15, 2026
Same bug fires with a single-value search param, not just repeated keys — so PR #93368's fix won't cover the broader case.
Single-value reproduction
Next 16.2.6 (also confirmed 16.2.5). App Router. Standard
next startafternext build. Not static export.npm run build && npm start, open/listings, click the button.GET /listings?regions=75&_rsc=...→200 text/x-component→net::ERR_ABORTEDmid-body.next devworks correctly. Direct URL load works correctly. Navigating to a different pathname works correctly.router.replace,<Link href="/listings?regions=75">from/listings, andhistory.pushState + router.refresh()all fail the same way.This is not
regions=red®ions=green → regions=red®ions=blue(PR #93368's target). It's(no regions param) → regions=75. A single key, a single value, going from absent to present.Trace (patched
node_moduleswithconsole.errormarkers)The fetch succeeds,
completeSoftNavigationreturns a state with the correctcanonicalUrl, the promise fromuseActionQueueresolves, React renders bothRouterandHistoryUpdaterwith the newcanonicalUrl— butHistoryUpdater'suseInsertionEffect(which callswindow.history.pushState) never fires. The transition renders but never commits.Hypothesis (please verify)
updateCacheNodeOnNavigationinppr-navigations.js(around line 159):For same-pathname-different-query:
isSamePageNavigationisfalse(because the full URL differs).__PAGE__leaf is recreated becausematchSegment(newSegment, oldSegment)is false (the page segment's serialized identity includes the search params).The resulting cache tree mixes reused-old-RSC parents with a freshly-created-deferred-RSC leaf. After
writeDynamicDataIntoNavigationTaskresolves the leaf's deferred promise, React 19's concurrent renderer keeps re-running the render but never commits — classic "transition starts and renders but commit is held back." This mirrors what reporter on #92152 sees and what we see; PR #93368'ssearchStringToRecordfix addresses one specific cause of the cache-key mismatch (repeated keys) but doesn't address the broader mixed reuse/new tree pattern that triggers on any single-value change.Workarounds tested end-to-end (Puppeteer against real prod build)
router.push(target)router.replace(target)<Link href={target}>from same pagehistory.pushState + router.refresh()history.pushState({__NA: true}) + router.refresh()router.push('/other') + router.push(target)same tickrouter.push('/other')+ 50ms delay +router.push(target)window.location.assign(target)(hard navigation)We're shipping
window.location.assignin our app to keep moving. Would love to remove it once a real fix lands. Happy to provide the full Puppeteer + patched-node_modulesdiagnostic scripts if useful.transfer1992 commentedon May 20, 2026
This bug is very severe for our ecommerce platform and we are unable to downgrade because of the recent CVE :(
caelumvallis commentedon May 20, 2026
Due to this issue, we are seeing significant incorrect behavior in our system and are forced to use workarounds with the refresh() function to solve the problem
genie-ru commentedon May 22, 2026
@lorenzoedoardofrancesco
Thanks for the detailed report. I tried reproducing your single-value case (
/listings→/listings?regions=75) on 16.2.6 withnext build && next start, using a minimal setup without external dependencies like Prisma, but navigation worked correctly on my end.Could you share a minimal reproduction repository with those dependencies removed? That would help us isolate whether this is a Next.js core issue or environment-specific.
PR #93368 targets the duplicate-key cache collision described in this issue, so the broader case you're describing may need a separate issue.
lorenzoedoardofrancesco commentedon May 25, 2026
@genie-ru
Repro repo: https://github.com/lorenzoedoardofrancesco/next-router-push-query-bug
Stock create-next-app (Next 16.2.6, React 19.2.4, Node 24) plus three files: async Server Component at
/listings that reads ?regions and renders ?count=N fake rows in a table, a Client Component with
router.push buttons, and a loading.tsx. No Prisma, no NextAuth, no Tailwind, no fonts, no middleware.
One correction vs. the original issue text: in this minimal repro I didn't reproduce the exact 200
text/x-component then net::ERR_ABORTED mid-body Network signature I had against the real app. The
user-visible symptom is identical, but the network failure mode in the simpler scenario looks different.
Worth a closer look from your side.
Happy to open a new issue for this if you prefer, since you noted PR #93368's scope is the duplicate-key
case. Let me know which one you'd like me to follow up under.
EnzoPV25 commentedon Jun 9, 2026
Hi there !
I got the same problem, downgrading to 16.1 fixes it. I don't want to downgrade so for now using router.refresh works.
Using revalidePath in a server would also work but isn't idiomatic when used form client components since it needs to be async to be a server action wherease revalidePath isn't async at all.
For now using router.refresh() does the job but I hope to see a fix on the next version :)
lorenzoedoardofrancesco commentedon Jun 10, 2026
Follow-up on my earlier single-value report (
/listings->/listings?regions=75never committing in prod builds): root cause identified. It is not the router or the segment cache - it is the React canary that Next vendors innext/dist/compiled/react*.TL;DR
The hang is react/react#35821 ("useDeferredValue getting stuck"), fixed upstream by react/react#36134 (merged 2026-03-24). The fix reached Next via the vendored React upgrade in #91905 (
19.3.0-canary-8b2e903a-20260320->19.3.0-canary-3cb2c420-20260324), first published in16.2.1-canary.11. It was never backported to the 16.2 release branch: every 16.2.x stable up to and including 16.2.9 (published 2026-06-09) still vendors19.3.0-canary-3f0b9e61-20260317, which predates the React fix. That is why the bug reproduces on all 16.2.x stables while the canary/16.3 line is unaffected since late March.This explains the failure mode exactly: the navigation transition renders (Router and HistoryUpdater both re-render with the new canonicalUrl) but React never commits it, so HistoryUpdater's
useInsertionEffect- which callshistory.pushState- never fires. URL frozen, Server Component data never swapped in, no error anywhere.How it was isolated
All tests against my repro (https://github.com/lorenzoedoardofrancesco/next-router-push-query-bug):
next build && next start, Puppeteer clicks therouter.push("/listings?regions=75")button, asserts URL change + fresh server-rendered content after 8s.16.2.1-canary.10reproduces,16.2.1-canary.11is fixed. The commit range between the two builds (d529a233e8...2fe21375d9) contains 6 commits; the only one touching runtime code is the React upgrade Upgrade React from8b2e903a-20260320to3cb2c420-20260324#91905.dist/compiled/{react,react-dom,react-server-dom-*,scheduler}*from the16.2.1-canary.11package into an otherwise untouched16.2.1-canary.10install flips the repro from broken to fixed. Same graft onto stock16.2.7: also fixed. No other file changes.updateCacheNodeOnNavigationcorrectly recreates the__PAGE__leaf (__PAGE__vs__PAGE__?{"regions":"75"}), the dynamic response matches every task segment,writeDynamicDataIntoNavigationTaskfulfills all pending nodes, andfinishNavigationTaskexits with status 0 (no tree mismatch, no retry). The cache layer completes cleanly; the loss happens afterwards, inside React's commit.Version matrix (all verified with the repro unless noted)
Two clarifications on my earlier report:
net::ERR_ABORTEDon the_rscfetch is a red herring: it shows up identically on the passing builds (it is the static-stage body-clone cancellation infetch-server-response.ts), so it is not a useful signal for this bug.Ask
Could the vendored React upgrade (#91905, or any later pin >=
3cb2c420-20260324) be backported to the 16.2 release branch? On 16.2.x stable, every same-pathnamerouter.push/router.replace/<Link>navigation that only changes the query string silently fails in production - filters, sort headers, pagination - with no error and no console output, while dev mode works. Several commenters above are pinned on 16.2.x because of the CVE fixed there, so the practical alternatives today are downgrading to 16.1 or moving to the 16.3 preview line.fix: call router.refresh() before replace() to fix stuck invoice filters
3 remaining items
fix(web): two different /foretag/sok filters could be one router-cach…
fix(companies): a second filter change in a row was silent, and a chi…
feat(companies): a bransch or ort chip applies the filter, instead of…
fix(web): two different /jobb filters could be one router-cache entry (…
transfer1992 commentedon Aug 13, 2026
We are severely impacted by this as well, so we decided to build a local
patch-packagesetup based on #93368.We cannot wait anymore, the
router.refresh()approach causes more problems than it solves.juanfranciscocis commentedon Aug 13, 2026
Hi @transfer1992 , this was fixed on 16.3!
We just upgraded and is working without the router.refresh() "fix"
transfer1992 commentedon Aug 13, 2026
This is great news. I was under the impression that it was not fixed in 16.3 and I was not able to test it myself yet, because we have a 14 days policy for package age. Will check it out as soon as possible.
Thank you for taking your time to write this, you really helped me!
genie-ru commentedon Aug 14, 2026
Hi @transfer1992
Looks like this was fixed in #94863 (merged into canary, released in 16.3).
Upgrading to [email protected] or later should resolve this — as also confirmed by @juanfranciscocis above — without needing the router.refresh() workaround.
Actualiza Next.js a 16.3.1 para corregir la navegación cliente congelada
marcoshernanz commentedon Aug 25, 2026
Thanks for the report and reproduction. This was fixed by #94863 and released in Next.js 16.3.0. I verified that 16.2.12 still reproduces the issue, while both
next devandnext startwork correctly on 16.3.3. Please upgrade to 16.3 or later.github-actions commentedon Aug 25, 2026
This issue was closed by a maintainer. If you think it was closed by mistake, you can request that it be reopened within the next 14 days.
Reply with
Reopen: <reason>and explain why the issue is still relevant. If you opened this issue or commented before it was closed, the issue will be reopened automatically.After 14 days, please open a new issue with up-to-date details and a reproduction, when applicable.
github-actions commentedon Sep 11, 2026
This closed issue has been automatically locked because it had no new activity for 2 weeks. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you.