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
mute-gold•4mo 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)
rare-sapphireOP•4mo 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?mute-gold•4mo ago
i think so yes
rare-sapphireOP•4mo ago
Found a workaround though it feel hacky but it will do for now. Thank you for responding.

mute-gold•4mo ago
still a issue would help to dive deeper
rare-sapphireOP•4mo 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.