Describe the bug#
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.
Your Example Website or App#
https://stackblitz.com/edit/github-spzf56-us3fam?file=src%2Froutes%2F_layout.index.tsx
Steps to Reproduce the Bug or Issue#
- Go to the about route
- Go to index route through address bar, omit search params
Expected behavior#
Context should be defined in all cases
Screenshots or Videos#
No response
Platform#
- Browser: all
- Version: 1.33.7
Additional context#
No response
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