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
{{ message }}
Repository navigation
Context is undefined when search validation fails #1656
I've discovered that the missing context bug isn't fully fixed in 1.33.7. Also sorry for sort of spamming the other closed issue, I thought I'd open a new one.
I'm not completely sure of what's triggering it or if there's more cases but these are the steps in my own app
open a route with no search validation (not sure this part is relevant)
directly enter a route into the address bar that has search validation, but don't include any search params in the address
navigate to the route, context should be undefined
My schema catches and fills values like the docs suggest. In step 3 when the error component is fired, it does still put the caught values into the url. I broke the validateSearch method into pieces instead of directly returning a schema, and it specifically fails when anything is returned in the method.
I found this in v1.34.9 as well, causing context to become undefined if the route that throws the redirect has search params that are being validated through validateSearch, and the validation fails/throws (e.g. with zod).
Activity
melv-n commentedon Jun 3, 2024
I found this in
v1.34.9as well, causingcontextto becomeundefinedif the route that throws the redirect has search params that are being validated throughvalidateSearch, and the validation fails/throws (e.g. withzod).Here's a complete repro:
https://stackblitz.com/edit/tanstack-router-qbczsv?file=src%2Froutes%2Findex.tsx
schiller-manuel commentedon Jul 6, 2024
this will be fixed by #1907
reproducer with the pre-release package: https://stackblitz.com/edit/tanstack-router-93gdrp?file=src%2Froutes%2Findex.tsx