Router NotFoundRoute not working in File-Based routing
CC this discussion: https://github.com/TanStack/router/discussions/1013
After digging around and trying various things to get a fallback
My project structure is simple:
- /routes
- /login
- route.tsx
- root.tsx
- main.tsx
In my
From the TanStack dev tools:
-
I'm struggling to figure out how to get a universal fallback to work without having a catchall at every point in the file route tree.
After digging around and trying various things to get a fallback
NotFoundRoute page to load, I had found this discussion in hopes that it would lead me somewhere. I'm met with an impasse, however.My project structure is simple:
- /routes
- /login
- route.tsx
- root.tsx
- main.tsx
In my
main.tsx, I follow the docs at https://tanstack.com/router/v1/docs/guide/creating-a-route#not-found-route to set up a fallback for File-Based routing.From the TanStack dev tools:
-
localhost:5173 - matches `root. Root component is rendered.
- localhost:5173/foo - matches root and /404. NotFoundRoute is rendered.
- localhost:5173/login - matches (in order) root and /login. Login component is rendered.
- localhost:5173/login/foo - matches (in order) root__, /login, and /404`. NotFoundRoute is not rendered, instead the Login component is.I'm struggling to figure out how to get a universal fallback to work without having a catchall at every point in the file route tree.
GitHub
I've got a pretty basic implementation of the router to give it a POC/test run but I'm struggling to figure out how to implement notFoundRoute in file-based routing. Is there an example ava...