TanStack / TanStack/router

fix(router-core): handle matches whose routes are removed from routeTree

Open
#7,797 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
15.1k
Forks
1.9k
Avg merge
1d 20h
Merged PRs (30d)
143

Description

Problem

Applications can replace routeTree while existing, pending, or cached matches still reference routes removed from the new tree.

Route lookups through looseRoutesById[match.routeId] then return undefined. This can crash cache cleanup, Devtools age rendering, and lifecycle callback dispatch.

Scope

  • Evict cached matches whose route no longer exists during clearExpiredCache.
  • Make Devtools AgeTicker render nothing for an orphaned match.
  • Skip lifecycle callback dispatch for matches whose route has been removed.
  • Preserve existing behavior for current routes and for routes without loaders.
  • Add router-core regression coverage that loads a route, replaces the route tree without it, and completes a navigation or cache-cleanup cycle without throwing.
  • Add focused Devtools coverage for an orphaned match in AgeTicker.

Related Work

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in router-core by tracing clearExpiredCache, route lookups through looseRoutesById, and lifecycle callback dispatch, then inspect Devtools AgeTicker handling. Add regression coverage for replacing routeTree and completing navigation or cache cleanup, plus focused AgeTicker coverage; done means orphaned matches are safely evicted, ignored, or rendered empty without affecting current routes.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
devtools, frontend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
68/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.