Which project does this relate to?
Router
Describe the bug
When using stripSearchParams along side retainSearchParams, the params specified in retainSearchParams are not long stripped from the URL that are also specified in stripSearchParams.
const DEFAULTS = {
param1: 1,
param2: 2,
} as const;
export const Route = createFileRoute('/')({
validateSearch: v.object({
param1: v.optional(v.fallback(v.number(), DEFAULTS.param1), DEFAULTS.param1),
param2: v.optional(v.fallback(v.number(), DEFAULTS.param2), DEFAULTS.param2),
}),
search: {
middlewares: [retainSearchParams(['param2']), stripSearchParams(DEFAULTS)],
},
component: Home,
});
In the above example, param2 is never stripped from the URL, even when the value is 2
Complete minimal reproducer
https://github.com/OwenVey/query-param-bug
Steps to Reproduce the Bug
- Run the dev server of the project
- Go to http://localhost:3000/ in your browser
- Notice that
param3 is not stripped from the URL
Expected behavior
If a param is specified in retainSearchParams as well as stripSearchParams, it should still be stripped from the URL when the default value is set.
Screenshots or Videos
No response
Platform
- Router / Start Version:
1.170.11
- OS: Windows
- Browser: Chrome
- Browser Version:
149.0.7827.54 (Official Build) (64-bit)
- Bundler: Vite
- Bundler Version:
8.0.16
Additional context
No response
Which project does this relate to?
Router
Describe the bug
When using
stripSearchParamsalong sideretainSearchParams, the params specified inretainSearchParamsare not long stripped from the URL that are also specified instripSearchParams.In the above example,
param2is never stripped from the URL, even when the value is2Complete minimal reproducer
https://github.com/OwenVey/query-param-bug
Steps to Reproduce the Bug
param3is not stripped from the URLExpected behavior
If a param is specified in
retainSearchParamsas well asstripSearchParams, it should still be stripped from the URL when the default value is set.Screenshots or Videos
No response
Platform
1.170.11149.0.7827.54 (Official Build) (64-bit)8.0.16Additional context
No response