Why is the same Route validateSearch called so many times with different input parameters? Child routes are broken #1051
Unanswered
notsoluckycharm
asked this question in
Q&A
Replies: 1 comment
-
I think I figured out what I was missing. The validateSearchParams is called for every usage of the route, which includes calls to Link and navigate(), etc. I took this functionality to assume it was validating just the current URL to massage the params prior to invoking the rest of the route. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hello,
I've been playing around with the Router and have come across what I think to be a bug, but perhaps I am looking at it incorrectly. You can reproduce this issue on the "kitchen sink" sandbox
kitchen-sink-react-query-file-based
with one simple change.in the file dashboard.invoices.$invoiceId.tsx, if you change the validateSearch to log what it's receiving as input you will see that it does not receive the same input for each call. You'll also notice some 30+ calls being logged to the console. Some are {}, some are {showNotes: undefined} some are {showNotes: true} - basically you will receive several iterations.
The demo has these coded as optional. But once you make any value required, the site will break if that value is there or isn't there. Since just 1 in 30 of those calls results in an error, meaning rendering is halted. And for some reason, it gets numerous different values as input.
It is my assumption it shouldn't be this way, especially since the demos contain it, and the latest branch also contains it. Thank you for your time.
Beta Was this translation helpful? Give feedback.
All reactions