You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am using both the stripSearchParams and retainSearchParams middlewares to strip default values from the query params as well as removing any parameters not related to that route. This works as expected as shown in the reproduction URL below but the moment I use my DefaultSearch object in a Link like so:
Open reproduction link and click the "Open Preview in new tab" button in the top right corner (so that we can see search params in URL)
Notice that when switching between the "Home" and "About" tabs, the middlewares are working as expected and the DefaultSearch objects are being displayed as expected.
Go to the __root.tsx file and uncomment lines 20 and 29
Switch between the two tabs and notice that the DefaultSearch objects are displayed as {} and the search middlewards no longer function as expected.
Expected behavior
I expect my DefaultSearch object be unmodified and log out as originally created but I am seeing it log as an empty object when using my DefaultSearch in a <Link>'s serach.
Which project does this relate to?
Router
Describe the bug
I am using both the
stripSearchParams
andretainSearchParams
middlewares to strip default values from the query params as well as removing any parameters not related to that route. This works as expected as shown in the reproduction URL below but the moment I use myDefaultSearch
object in aLink
like so:the
DefaultSearch
object itself becomes{}
which then causes problems with the middlewares.My guess is there is a bug somewhere where the object being passed to
search
is being overwritten.Your Example Website or App
https://stackblitz.com/edit/tanstack-router-fyxlu6?file=src%2Froutes%2F__root.tsx
Steps to Reproduce the Bug or Issue
DefaultSearch
objects are being displayed as expected.__root.tsx
file and uncomment lines 20 and 29DefaultSearch
objects are displayed as{}
and thesearch
middlewards no longer function as expected.Expected behavior
I expect my
DefaultSearch
object be unmodified and log out as originally created but I am seeing it log as an empty object when using myDefaultSearch
in a<Link>
'sserach
.Screenshots or Videos
Platform
Additional context
Mentioned in the TanStack Discord here: https://discord.com/channels/719702312431386674/1306270495016095847/1306442814875242548
The text was updated successfully, but these errors were encountered: