Skip to content
Discussion options

You must be logged in to vote

This is a quirk of where notFound() gets caught depending on which hook throws it.

Thrown from a loader, it renders the nearest route's own notFoundComponent. But thrown from beforeLoad, it always bubbles up to the root route's notFoundComponent, because beforeLoad runs before the route's data is guaranteed to be there, so the router can't safely render that route's own boundary. If your __root route (or the router's defaultNotFoundComponent) doesn't define one, there's nothing to render and you get the blank page. That's why the loader version worked and the beforeLoad version didn't.

Fix is to give the root a not-found component:

export const Route = createRootRoute({
  notFoundComponent: 

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by RBkalfrisa
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants