Skip to content

Start: beforeLoad notFound() broken #5644

Closed

Description

@daveycodez

Which project does this relate to?

Start

Describe the bug

When you throw notFound() in beforeLoad in index.tsx, it will not render its notFoundComponent. It will however render __root.tsx notFoundComponent if it is set, but there will be a CSS flicker of styles. Full repo here:

Your Example Website or App

https://github.com/daveycodez/start-broken-notfound-example

Steps to Reproduce the Bug or Issue

Clone the GitHub project and run pnpm dev
index.tsx will render a white page
Uncomment the notFoundComponent from __root.tsx
index.tsx will now render __root.tsx's notFoundComponent, and the background color will flicker on page refresh

Expected behavior

beforeLoad throw notFound() should render the route's own notFoundComponent, and fallback with "fuzzy" mode.

Platform

"@tanstack/react-router": "^1.133.32",
"@tanstack/react-start": "^1.133.32",

Activity

  1. roduyemi commented on Oct 27, 2025

    @roduyemi
    Contributor

    Docs were recently updated to reflect this. See here. Not sure about the styles flicker you're seeing though.

    ⚠️ Throwing a notFound error in a beforeLoad method will always trigger the __root notFoundComponent. Since beforeLoad methods are run prior to the route loader methods, there is no guarantee that any required data for layouts have successfully loaded before the error is thrown.

  2. jasperteo commented on Nov 4, 2025

    @jasperteo

    Docs were recently updated to reflect this. See here. Not sure about the styles flicker you're seeing though.

    ⚠️ Throwing a notFound error in a beforeLoad method will always trigger the __root notFoundComponent. Since beforeLoad methods are run prior to the route loader methods, there is no guarantee that any required data for layouts have successfully loaded before the error is thrown.

    There will be a FOUC if you refresh the route that threw notFound() in beforeLoad, or enter the route directly from the address bar. There is however no FOUC for client side navigations to the route. Not sure if it is tailwind related or not.

  3. Pyakz commented on Dec 21, 2025

    @Pyakz

    up

  4. schiller-manuel commented on Mar 30, 2026

    @schiller-manuel
    Collaborator

    this has been fixed

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