useSearchParams context is missing search params from rewritten url #58256
Labels
bug
Issue was opened via the bug report template.
Navigation
Related to Next.js linking (e.g., <Link>) and navigation.
Link to the code that reproduces this issue
https://github.com/noreiller/next-missing-search-params-with-rewrites
To Reproduce
npm run dev
)http://localhost:3000/app-url-to-rewrite
foo
is not detectedCurrent vs. Expected behavior
When we use a rewrite containing search params, for example to the destination
/my-page?foo=bar
, we expect that the search paramfoo
is available from theuseSearchParams()
hook and has the valuebar.
Currently, the
useSearchParams()
hook does not return any search param.With
next/router
(Page Router), the query object contains the expected search params.This occurs in both App Router and Page Router.
Verify canary release
Provide environment information
Operating System: Platform: linux Arch: x64 Version: #35~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Fri Oct 6 10:23:26 UTC 2 Binaries: Node: 18.12.1 npm: 8.19.2 Yarn: 1.22.19 pnpm: 8.2.0 Relevant Packages: next: 14.0.1 eslint-config-next: 14.0.1 react: 18.2.0 react-dom: 18.2.0 typescript: 5.2.2 Next.js Config: output: N/A
Which area(s) are affected? (Select all that apply)
App Router, Routing (next/router, next/navigation, next/link)
Additional context
No response
The text was updated successfully, but these errors were encountered: