Are parent loaders always meant to overrule child loaders? #11357
Replies: 1 comment 2 replies
-
Is the <Route path="/id" loader={() => throw notfound()}>
<Route path="redirect" loader={() => throw redirect('example')}/>
<Route path="example" />
</Route> |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Say I have the following routing setup:
/<id>
- will throw a 404 if id is not a number/<id>/redirect
- will throw a redirect to/<id>/example
/<id>/example
- a normal pageIf I go to
/123/redirect
, I am redirected to/123/example
as expected.But if I go to
/foo/redirect
, I am redirected to/foo/example
. I would expect a 404 instead - the parent loader will throw a 404 asfoo
is not a number. I can see the parent loader does throw the 404 as expected, but the child loader's redirect takes priority.This seems to be related to redirects specifically - if I had the child loader throw a 500 instead, the user gets the 404, the 500 is ignored.
I'm not sure if this is a bug or I'm misunderstanding how the parent/child loaders work together. Does anybody know what is going on here? Thanks.
Beta Was this translation helpful? Give feedback.
All reactions