Repository navigation
Description
Link to the code that reproduces this issue
To Reproduce
I've generated a test suite which demonstrates this bug
pnpm install
pnpm dev # starts on :3100
# in another shell:
pnpm exec playwright install chromium
pnpm exec playwright testYou can also re-produce manually by:
- loading
localhost:3100 - toggling each of the 2 filters on, incrementing the count by 1 each time
- toggling one of the filters off, which does not decrement the count as expected
Current vs. Expected behavior
Current
When router.replace(url, { scroll: false }) changes a repeated search-param from multiple values (?k=A&k=B) to a single value (?k=B), the new RSC payload is fetched and the server renders with the correct searchParams, but the client tree never commits the update. The server-rendered JSX and the client component's server-passed props stay stale. Other transitions on the same param (empty→single, single→multi) commit correctly — only multi→single is broken. It also seems to work if the toggle is done a second time?
here are the logs pulled from my browser console.
Server [server] f.status = [] count = 0
toggles.tsx:20 [client] props.count = 0 props.values = [] url.values = []
installHook.js:1 [client] props.count = 0 props.values = [] url.values = []
host-console-events.js:1 [client] props.count = 0 props.values = [] url.values = []
host-console-events.js:1 [client] props.count = 0 props.values = [] url.values = []
host-console-events.js:1 Server [server] f.status = ["A"] count = 1
host-console-events.js:1 [client] props.count = 1 props.values = ["A"] url.values = ["A"]
host-console-events.js:1 [client] props.count = 1 props.values = ["A"] url.values = ["A"]
host-console-events.js:1 [client] props.count = 1 props.values = ["A"] url.values = ["A"]
host-console-events.js:1 [client] props.count = 1 props.values = ["A"] url.values = ["A"]
host-console-events.js:1 Server [server] f.status = ["A","B"] count = 2
host-console-events.js:1 [client] props.count = 2 props.values = ["A","B"] url.values = ["A","B"]
host-console-events.js:1 [client] props.count = 2 props.values = ["A","B"] url.values = ["A","B"]
host-console-events.js:1 [client] props.count = 2 props.values = ["A","B"] url.values = ["A","B"]
host-console-events.js:1 [client] props.count = 2 props.values = ["A","B"] url.values = ["A","B"]
host-console-events.js:1 [client] props.count = 2 props.values = ["A","B"] url.values = ["B"]
host-console-events.js:1 [client] props.count = 2 props.values = ["A","B"] url.values = ["B"]
host-console-events.js:1 Server [server] f.status = ["B"] count = 1
they are missing the client logs which should say:
[client] props.count = 1 props.values = ["B"] url.values = ["B"]
host-console-events.js:1 [client] props.count = 1 props.values = ["B"] url.values = ["B"]
Expected
The client tree always responds to data updates
Provide environment information
Operating System:
Platform: darwin
Arch: arm64
Version: Darwin Kernel Version 25.3.0: Wed Jan 28 20:53:31 PST 2026; root:xnu-12377.81.4~5/RELEASE_ARM64_T8122
Available memory (MB): 16384
Available CPU cores: 8
Binaries:
Node: 22.14.0
npm: 10.9.2
Yarn: 1.22.22
pnpm: 10.29.2
Relevant Packages:
next: 16.2.4 // Latest available version is detected (16.2.4).
eslint-config-next: N/A
react: 19.0.0
react-dom: 19.0.0
typescript: 5.9.3
Next.js Config:
output: N/AWhich area(s) are affected? (Select all that apply)
React
Which stage(s) are affected? (Select all that apply)
next dev (local), next start (local)
Additional context
full disclosure, this re-production was generated by Claude Code! But spun out of a real bug i found in my code. I took a look at the minimal re-pro and it seems like it should be working
Activity
Ingole712521 commentedon Apr 22, 2026
I was able to reproduce this consistently, and it does look like a framework-level issue rather than a problem with the user code.
From debugging, it seems that during a
multi → singletransition (e.g.?k=A&k=B→?k=B), the server correctly renders the new state and the RSC payload is fetched, but the client tree doesn’t commit the update. The URL reflects the new value, but the client component continues to receive stale props. Other transitions (empty → single, single → multi) behave as expected.As a temporary workaround, forcing a client refresh right after the navigation makes the state consistent again:
Alternatively, forcing a remount via a
keyderived from the search params also avoids the issue:Both approaches essentially bypass the stale tree reuse and ensure the new RSC payload is applied.
This suggests the issue might be related to how the App Router determines cache identity or reuses the existing tree when repeated search params shrink from multiple values to a single value.
Happy to help test any fixes or provide more logs if needed
dave-wwg commentedon Apr 22, 2026
@Ingole712521 , i actually wasn't able to successfully force a remount using
key. can you share a more complete example, perhaps based on my example repro code?mlev commentedon Apr 22, 2026
Same for me - I couldn't force a remount. As per OP I can see the RSC request is made and correct data is returned but component doesn't re-render.
I think the cause is identified here: #92787 - but this issue is much easier to find!
NiteshCodes7 commentedon Apr 23, 2026
I tried solving this issue. Please let me know after reviewing it.
Link for the pull request I created - #93154 (comment)
Closes #93104
What's happening
When navigating from
?k=A&k=B(multi-value) to?k=B(single-value) viarouter.replace(), the client tree never commits the update — props stay stale even though the server renders correctly.Root cause
In
createSegmentFromRouteTreeinsideppr-navigations.ts, the client builds a segment cache key from the currentrenderedSearchstring:Object.fromEntrieson aURLSearchParamswith repeated keys silently drops all but the last value. This means:?k=A&k=B→{ k: "B" }→__PAGE__?{"k":"B"}?k=B→{ k: "B" }→__PAGE__?{"k":"B"}Both produce the same segment key, so
matchSegmenttreats them as identical, the stale cache node is reused, and the client never re-renders with the new props.This explains the asymmetric behavior reported in the issue:
empty → single✅ (keys are genuinely different)single → multi✅ (keys are genuinely different)multi → single❌ (keys wrongly collide due toObject.fromEntries)currentRenderedSearchhas caught up so the comparison path differs)Fix
Use
getAll()to preserve repeated values, matching exactly what the server does inaddSearchParamsIfPageSegment:Now:
?k=A&k=B→{ k: ["A", "B"] }→__PAGE__?{"k":["A","B"]}?k=B→{ k: "B" }→__PAGE__?{"k":"B"}These are distinct keys, the cache node is correctly replaced, and the client commits the updated props.
Testing
Reproduction repo from the issue: https://github.com/dave-wwg/next-multi-value-searchparam-repro
The existing playwright test suite in that repo passes after this fix (it was designed to fail when the bug is present).
fix: preserve repeated search params in client page segment cache keys (
fix: preserve repeated search params in client page segment cache keys (
marcoshernanz commentedon Aug 25, 2026
Thanks for the report. This was fixed in #94863 and shipped in Next.js 16.3.0. I confirmed the repro fails on 16.2.12 and passes on 16.3.0, 16.3.3, and the current canary, including a production run on 16.3.3. Please upgrade to 16.3 or newer. Closing as fixed.
github-actions commentedon Sep 10, 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.