Open andrejilderda opened 1 week ago
There is an issue in your reproduction. Your reproduction doesn't use any path parameters.
I've gone ahead and refactored it so that it does: https://stackblitz.com/edit/github-pk92xt-ve9tip
With this refactor, the correct errorComponent is shown based on where the error was thrown. For example, if I'm on /posts/
and the route /posts/123
throws an error, then if I render a <Link>
on /posts/
to /posts/123
, I should expect an error on the /posts/
route since that is where the Link
was called.
🚨 What's still broken, is that if I directly navigate to /posts/123
and then reload the page (remaining on /posts/123
), the page goes completely blank. Neither the outer content nor the errorComponent
s defined along the route-tree are rendered on the screen.
Thanks for looking into this and sorry about that @SeanCassiere . 🙈 Hopefully the fixed reproduction helps you fix the remaining bug.
Describe the bug
As described in the title there are two issues I've faced when an error is thrown inside
stringifyParams
.defaultErrorComponent
is rendered in stead of the providederrorComponent
on the route or parent route.ErrorComponent
) when landing on the route that throws an error instringifyParams
)Your Example Website or App
https://stackblitz.com/edit/github-pk92xt?file=src%2Froutes%2Findex.tsx,src%2Froutes%2Fnested%2Findex.tsx
Steps to Reproduce the Bug or Issue
Expected behavior
nested/index.tsx
,nested/route.tsx
orindex.tsx
Screenshots or Videos
https://github.com/TanStack/router/assets/487182/0c965bbb-2b38-49f7-a69e-3f6b258c516a
Platform
Additional context
If you need more info let me know!