Why might search be persisted through navigation?
I am wondering: why might search items be carried through an imperative call to
navigate({ to: '/some-place' }) (from useNavigate())? I cannot for the life of me figure out why, since the default behavior seems to be to clear the search items when navigate() is called even without explicit search: {}. In my case, explicitly calling navigate({ to: '/some-place', search: {} }) does not work--the search string is carried through. I cannot unfortunately reproduce this in a sample project. I'm happy to provide my full project's code but it relies on a separate backend. I'm hopeful that someone who really understands the internals of this library might be able to help. Thank you!6 Replies
solid-orange•16mo ago
I cannot unfortunately reproduce this in a sample project.that's odd are you passing
search: true into navigate somewhere?metropolitan-bronzeOP•16mo ago
Not to my knowledge.
solid-orange•16mo ago
is the search param originating from router?
or coming from somewhere else?
metropolitan-bronzeOP•16mo ago
The first route/page is navigated to by
navigate({ to: '/first-page'}, search: { redirect: '/other', expired: true }) (the expired is unimportant here). Those are the search values that are carried over when I navigate off of that route/page.solid-orange•16mo ago
which router version are you using?
metropolitan-bronzeOP•16mo ago
^1.38.1
I'll update and see what happens
Updating to the latest 1.46.8 seems to have solved the issue. I had searched the github issues and hadn't found anything relevant, so I assumed it was still present in the newer version. I have no idea what changed. Thank you for your time!
✅