Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Search params are removed in production unless useSearchParams is called #42438

Closed
1 task done
LukasMurdock opened this issue Nov 3, 2022 · 3 comments
Closed
1 task done
Assignees
Labels
area: app App directory (appDir: true)

Comments

@LukasMurdock
Copy link

Verify canary release

  • I verified that the issue exists in the latest Next.js canary release

Provide environment information

Operating System:
  Platform: darwin
  Arch: x64
  Version: Darwin Kernel Version 21.6.0: Mon Aug 22 20:17:10 PDT 2022; root:xnu-8020.140.49~2/RELEASE_X86_64
Binaries:
  Node: 16.14.2
  npm: 8.5.0
  Yarn: 1.22.18
  pnpm: N/A
Relevant packages:
  next: 13.0.2-canary.2
  eslint-config-next: 13.0.1
  react: 18.2.0
  react-dom: 18.2.0

What browser are you using? (if relevant)

No response

How are you deploying your application? (if relevant)

next start, Vercel

Describe the Bug

Search params seem to be removed in production unless useSearchParams hook is called somewhere. next dev seems to work fine. Bug occurs with next build and next start.

Expected Behavior

Expected search params to not be removed in production unless useSearchParams hook is called.

Link to reproduction

https://github.com/LukasMurdock/next-13-test

To Reproduce

Create a page in Next 13 /app that does not use useSearchParams hook anywhere and run next build and next start and attempt to load the page with any search parameters. Search parameters should be removed.

If you add a call useSearchParams() then search params are not removed.

I have a reproduction here:

@LukasMurdock LukasMurdock added the bug Issue was opened via the bug report template. label Nov 3, 2022
@leerob
Copy link
Member

leerob commented Nov 6, 2022

Confirmed this seems like a bug - thank you!

@timneutkens timneutkens added area: app App directory (appDir: true) kind: bug and removed bug Issue was opened via the bug report template. labels Nov 6, 2022
@timneutkens timneutkens self-assigned this Nov 6, 2022
@timneutkens
Copy link
Member

This is fixed in #42744, thanks for the report!

@github-actions
Copy link
Contributor

This closed issue has been automatically locked because it had no new activity for a month. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Dec 14, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area: app App directory (appDir: true)
Projects
None yet
Development

No branches or pull requests

3 participants