Skip to content

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

1 Commit

Folders and files

Repository files navigation

TanStack Router repro: stale child head after parent beforeLoad error

Minimal reproduction for a client-side head/meta issue.

Versions

"@tanstack/react-router": "1.170.15",
"@tanstack/react-start": "1.168.25",
"@vitejs/plugin-react": "6.0.2",
"react": "19.2.7",
"react-dom": "19.2.7",

Scenario

Route tree:

__root
  _app        // parent route with beforeLoad + head + errorComponent
    child     // child route with head

The parent _app route throws from beforeLoad when ?fail=true.

From router source, when a parent beforeLoad throws:

  • descendant beforeLoads are skipped
  • descendant loaders are skipped
  • headMaxIndex is capped to the throwing route
  • only heads up to the throwing route should execute

So the child route's head should not affect the document after _app.beforeLoad throws.

Repro

pnpm install
pnpm dev

Open:

http://127.0.0.1:3000/child?fail=false

The document title should be:

Child success title

Then client-navigate to:

http://127.0.0.1:3000/child?fail=true

using the link on the page.

Expected

The parent _app error component renders, and the document title should be from _app.head:

App error title

The child route head should not execute or influence the document head after the parent beforeLoad error.

Actual

On client navigation, the parent error component renders, but stale child meta/title can remain from the previous successful child match:

Child success title

This happens even though the child head is not supposed to participate after the parent beforeLoad error.

Relevant files

tss/routes/_app/route.tsx

tss/routes/_app/child/route.tsx

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages