Skip to content

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

Description

@lislon

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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions