Skip to content

Link component active/inactive reactivity is not updated on param change #5655

@balzdur

Description

@balzdur

Which project does this relate to?

Router

Describe the bug

When I do a navigation trigering a param change, links active reactivity logic is not updated accordingly.

If I pass explicitly the param as a prop, classic React reactivity do work.

It feels like a miss in the reactivity logic behind the sugar syntax that allow to describe relative navigation logic (using from/to props)

Your Example Website or App

https://stackblitz.com/edit/tanstack-router-vh8dm4rb?file=src%2Froutes%2Fpost.%24postId.tsx

Steps to Reproduce the Bug or Issue

  1. Navigate from post 1 to post 2 using the links inside step 1
  2. Navigate from post 1 to post 2 using the links inside step 2

The bold className is properly applied on step 2 after navigation but not on step 1 (meaning the reactivity is on on step 2 and not on step 1 Link).

Expected behavior

I expect Links to be reactive on params change.
If not (this could be a feature to opt out of reactivity when params are not explicitly listed), this might be good to update the doc accordingly.

Screenshots or Videos

No response

Platform

  • Router / Start Version: [e.g. 1.121.0]
  • OS: [e.g. macOS, Windows, Linux]
  • Browser: [e.g. Chrome, Safari, Firefox]
  • Browser Version: [e.g. 91.1]
  • Bundler: [e.g. vite]
  • Bundler Version: [e.g. 7.0.0]

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