Skip to content

Randomly not matching index.tsx routes where we have index.tsx + route.tsx per route. #5635

@shmuel-levinson-z

Description

@shmuel-levinson-z

Which project does this relate to?

Router

Describe the bug

Important: PROBLEM REPRODUCES ON CHROME BUT NOT ON FIREFOX. Verified by Tanstack maintainer.

I'm encountering a mind-bending issue with file-based routing: in our setup, each folder has route.tsx and index.tsx as siblings, both calling createFileRoute, and we expect two matches (one for each).
For certain routes, the index.tsx match (the one rendering the component) completely fails to register, leaving only the route.tsx match.
To make it worse, the issue seems interdependent—renaming or removing unrelated folders sometimes resolves or breaks it for others. Deleting route.tsx in any problematic case SOLVES the problem for that folder.

The folder names appears to be the ONLY determining factor from testing we'd done -- certain 'lucky' names work., but changing any of these had no effect at all: properties in createFileRoute, rendering Outlet explicitly in the route.tsx file, rendering components inline or imported, switching autoCodeSplitting to false (though we need it to be true...).

NOTE: if no change to code is introduced then the exact same pages will fail consistently across page visits.

Optional params or lack thereof make no difference. This issue existed on a page without optional param. Solved it there by removing route.tsx.

We also tried looking at routeTree.gen to see maybe the problematic pages had some duplicate or missing entries but couldn't spot any anomalies.

On the face of it problematic pages are implemented exactly like any other working pages in any regard.

The reproduction repo is a completely stripped down version with nothing but the routes structure and an example of a working page and a non-working page.

Your Example Website or App

https://github.com/Shmuel-Levinson/random-non-render

Steps to Reproduce the Bug or Issue

  1. Open up the matches tab
  2. Go to the working link
  3. Observe there are 2 matches (one for the route.tsx file and the other for index.tsx)
  4. Go to the not-working link and see the path for index.tsx is NOT matched and hence nothing is displayed.

Expected behavior

I expect the index.tsx to be matched

Screenshots or Videos

random-non-render-example.mov

Platform

  • Router Version: ^1.133.36 or latest
  • OS: macOS
  • Browser: Chrome
  • Browser Version: 142.0.7444.60 (latest as of oct-29-2025)
  • Bundler: vite
  • Bundler Version: 7.1.11 (latest)

Additional context

No response

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