notFoundComponent bubbles up regardless, why?
I've tried specifying
defaultNotFoundComponent in the router, and also instead defining notFoundComponent in _root.tsx. When I throw notFound()inside a sub-route's beforeLoad, it bubbles up, instead of rendering that sub-route's notFoundComponent, why?6 Replies
adverse-sapphire•13mo ago
Matching does not happen when
beforeLoad is ran, so it does not know the route you are on, you can
in beforeLoad and then throw in loader
adverse-sapphireOP•13mo ago
Ahh, got it
That makes sense, I went down debugging the internals, and but it hard to see that this was the behavior, as a I always saw it recursively matching parent routes
adverse-sapphire•13mo ago
Yeah, it's somewhat confusing, this could be added to the docs of
beforeLoad or/and notFoundadverse-sapphireOP•13mo ago
I agree, because I saw it in those docs and thought it had to do with an example that was related to loader
The docs are awesome, but there is still a lot of guess work and try/error one has to go thru, just because getting the docs perfect is so damn hard
adverse-sapphire•13mo ago
You can open PRs yourself to correct/add to the docs when you find something that needs documenting
tbh, I am annoyed that to get to the docs for the nvm, I am dumb, it is in the "Types" section
Router type, I have to go to createRouter and then click on it's return type, as it is not in the list on the API reference pageadverse-sapphireOP•13mo ago
I will open the PR