router icon indicating copy to clipboard operation
router copied to clipboard

404 is not bubbling up to the root when loader is present

Open lislon opened this issue 4 months ago • 0 comments

Which project does this relate to?

Router

Describe the bug

I have notFoundComponent on root component, and I'm throw notFoundError() on child component.

Instead of showing root's defined 404, the fallback 404 is shown with a warning:

A notFoundError was encountered on the route with ID "${route.id}", but a notFoundComponent option was not configured, nor was a router level defaultNotFoundComponent configured. Consider configuring at least one of these to avoid TanStack Router's overly generic defaultNotFoundComponent (<div>Not Found<div>)

This is happens, when there is a beforeLoad or load on root router. If I remove them, it works as expected

Your Example Website or App

https://stackblitz.com/edit/github-waadja-f2kpdp?file=src%2Froutes%2F__root.tsx

Steps to Reproduce the Bug or Issue

  1. Open demo app
  2. Click on About

Expected behavior

Message Root not found (EXPECTED)

Screenshots or Videos

Image

Platform

  • OS: [e.g. macOS, Windows, Linux]
  • Browser: [e.g. Chrome, Safari, Firefox]
  • Version: [e.g. 91.1]

Additional context

No response

lislon avatar Oct 15 '24 14:10 lislon