If validateSearch
rewrites URL, router nav works but initial load fails (with strange behavior)
#1928
Labels
bug
Something isn't working
Describe the bug
If the validation function not only validates but also returns something other than what it got (e.g. get empty input, return object with defaults), then the URL gets rewritten and page load fails. When using router navigation the URL is not rewritten and page load is successful.
What I mean by "page load fails": Not sure exactly what is going wrong, but in my repro the manifestation is that
throw notFound()
gets ignored and the route's match status is erroneously "success".The repro uses a
validateSearch
function from the docs so I assume it's supposed to work.Your Example Website or App
https://stackblitz.com/edit/tanstack-router-uyzm48?file=src%2Froutes%2Fposts.%24postId.tsx
Steps to Reproduce the Bug or Issue
/posts/<something>
route (WORKS)/posts/<something>?page=1&filter=&sort=newest
(I think this is the thing that isn't handled well)Expected behavior
Full page load and router navigation should share the same URL rewriting (or non-rewriting) behavior. They should result in the same page behavior as well. A validateSearch function that returns extra defaults or something else not strictly the same as its input should not cause a
throw notFound()
error to be ignored or any other strange behavior.Screenshots or Videos
No response
Platform
Additional context
No response
The text was updated successfully, but these errors were encountered: