errorComponent not rendering
Hi Guys. Hope you are all good.
I have a
notFoundComponent
and errorComponent
defined for a layout with some child routes defined in route.tsx
. The notFoundComponent
is getting rendered correctly when a route is not found but when an error occurs within those child routes, instead of rendering errorComponent
, it's rendering defaultErrorComponent
defined in router.tsx
which is not the behavior I am expecting. Is this the correct behavior or I am missing something?6 Replies
absent-sapphire•2mo ago
probably best is to create a github issue with a complete minimal reproducer (e.g. based on forking one of the router examples on stackblitz)
wee-sapphireOP•2mo ago
It's okay. I will create something blitz and attach to the issue. But the behavior I am looking for is correct right? If an error occurs in a route, the nearest
errorComponent
should be rendered i.e. the error bubbles up until finally reaches defaultErrorComponent
if not errorComponent
is found in between?absent-sapphire•2mo ago
i think so yes
wee-sapphireOP•2mo ago
Found a workaround though it feel hacky but it will do for now. Thank you for responding.

absent-sapphire•2mo ago
still a issue would help to dive deeper
wee-sapphireOP•2mo ago
Yes I will create an issue. I just wanted something to patch a work ticket since it was needed for our app. But definitely creating the issue.