Skip to content

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

Description

@LadyBluenotes

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Fields

    No fields configured for Bug.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions