Is it possible to render the notFoundComponent inside of my auth only layout?
Please take a look at this adjusted kitchen sink example: https://stackblitz.com/edit/tanstack-router-mg97mijn?file=src%2Froutes%2F__root.tsx
My app has a setup like this:
- _auth folder for routes only visible after login which has the navbar in the layoutless route
- _login folder for routes only visible before login which has the login page layout in the layoutless route
Please take a look at the stackblitz link. I've added an invalid lik to the /page which is visible after login, navigating to the link shows the not found component but it's full screen. If the user is logged in, the 404 page should be displayed inside of the logged in layout in order for the navbar and so on to be visible. Is this possible or do I need to adjust my routing approach?
Thank's a lot
reihwald
StackBlitz
404 - StackBlitz
Run official live example code for Router Kitchen Sink File Based, created by Tanstack on StackBlitz
6 Replies
xenial-blackOP•5mo ago
@Maintainer Please excuse my ping. Is this maybe a bug worth looking into/worth creating a GH issue or is this an implementation error on my side?
extended-salmon•5mo ago
hey sorry this somehow was lost. creating a GitHub issue makes sure we properly track issues so most of the times a good idea
we have at least two issues about the not found component open already, did you check whether they match yours ?
xenial-blackOP•5mo ago
They all look a little bit different
Is this something that should work the way i've implemented it?
Or how should auth only not found components be implemented?
extended-salmon•5mo ago
trying to understand your example
cant locate _login nor a link to /page
however, from reading your description:
if router determines that it cannot find a matching route, it can only show the notfound component
it cannot possibly know that it should nest it under a specific layout
you could however try this
extended-salmon•5mo ago
StackBlitz
404 (forked) - StackBlitz
Run official live example code for Router Kitchen Sink File Based, created by Tanstack on StackBlitz
xenial-blackOP•5mo ago
Wow I didn't think of that
Thank you very much!