TanStack / TanStack/router

feat(router-core): expose destination location to route lifecycle hooks

Open
#7,778 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Problem

Route lifecycle hooks receive the route match but not the resolved destination location. Consumers need the destination URL and search state in onEnter, onStay, and onLeave.

Proposal

Add a second callback argument:

  • onEnter(match, { location })
  • onStay(match, { location })
  • onLeave(match, { location })

Supersedes stale #3622 - which targeted an older lifecycle implementation, lacked runtime coverage for onStay and onLeave, and left onLeave typing unresolved.

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 at the router-core lifecycle hook entry points for onEnter, onStay, and onLeave, then trace their callback type definitions. Add the destination location to each callback's second argument and cover the runtime behavior and typing for all three hooks. Done means consumers can read the resolved URL and search state consistently.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
frontend
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
65/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.