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

Router searchParameter gets reset to default value (of zod schema) after navigations (and using retainSearchParams) #2845

Open
hakoomen opened this issue Nov 24, 2024 · 1 comment

Comments

@hakoomen
Copy link

hakoomen commented Nov 24, 2024

Which project does this relate to?

Router

Describe the bug

Using retained searchParams, if we change the retained param x form a to b on some route (lets say route-a) and we navigate to route-b, which doesn't change param x, param x will revert back to its default value.

This is a regression because it works on using older versions.

Same code older versions:
stackblitz
Same code latest versions:
stackblitz

Your Example Website or App

-see desc

Steps to Reproduce the Bug or Issue

  1. click on Home route (see Auth defaults to true)
  2. click on Settings route (see Auth remains true)
  3. click on About route (see now Auth is false)
  4. click on Home route:
    4.a older version: Auth remains as false (which is expected)
    4.b newer version: Auth changes back to true (which is unexpected)

Expected behavior

after chaning the retained searchParams, it should stay unchanged after navigations, and only change if explicitly said so.

  • some other weird thing here is that even without using this middle params stay on URL, kinda making retainSearchParams useless, unless im not grasping the use of it correctly.

Screenshots or Videos

No response

Platform

  • OS: [e.g. macOS, Windows, Linux]
  • Browser: [e.g. Chrome, Safari, Firefox]
  • Version: [e.g. 91.1]

Additional context

No response

@hakoomen hakoomen changed the title Router searchParameter gets reset eventhough we tell it to be persisted using retainSearchParams Router searchParameter gets reset to default value (of zod schema) after navigations (and using retainSearchParams) Nov 24, 2024
@schiller-manuel
Copy link
Contributor

which version exactly introduced the regression?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants