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
fair-rose•2d 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)
quickest-silverOP•2d 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?fair-rose•2d ago
i think so yes
quickest-silverOP•2d ago
Found a workaround though it feel hacky but it will do for now. Thank you for responding.

fair-rose•2d ago
still a issue would help to dive deeper
quickest-silverOP•2d 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.