#NotFoundComponent defined at the route level not rendering.

19 messages · Page 1 of 1 (latest)

deep jolt
#

Consider this folder structure.

__root.tsx -> notFoundComponent defined
settings/
  route.tsx -> notFoundComponent defined and <Outlet /> returned
  index.tsx -> component for /settings/

There are no loaders defined. When I visit /settings/unknown the notFoundComponent defined in __root.tsx is shown, not the one under settings. What am I missing.

full goblet
#

there is no lookup for a "closest" not found component happening.

#

not sure if this is even possible to realize

#

you could add a splat route under settings and throw a notFound there

deep jolt
#

Or I am misunderstanding the doc?

full goblet
#

you are right

#

did you set notfoundmode to fuzzy?

deep jolt
#

yes

full goblet
#

then please create a GitHub issue including a minimal complete reproducer

deep jolt
#

I set notfoundmode in createRouter to fuzzy

full goblet
#

either a bug or a misconfig, we will find out

#

I think I found the bug

deep jolt
#

Oh, really? I am still learning the router so unable to track the issue. Here is the reproducible stackbliz: https://stackblitz.com/edit/tanstack-router-gpzesz9s?file=src%2Froutes%2Fsettings%2Froute.tsx. I have notFoundPage at both __root.tsx and settings/route.tsx. When navigating to /settings/unknown, in theory, it should route to notFoundPage defined at settings/route.tsx, but it is being routed to __root.tsx.

Run official live example code for Router Quickstart File Based, created by Tanstack on StackBlitz

full goblet
#

this is a regression

#

can you please create a github issue for this so we can properly track it?

deep jolt
#

Sure.