Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: Regression of useResolvedPath in 6.19.0 and <Link to> in 6.20.0 #11053

Closed
slax57 opened this issue Nov 23, 2023 · 3 comments
Closed

[Bug]: Regression of useResolvedPath in 6.19.0 and <Link to> in 6.20.0 #11053

slax57 opened this issue Nov 23, 2023 · 3 comments
Labels

Comments

@slax57
Copy link

slax57 commented Nov 23, 2023

What version of React Router are you using?

6.20.0

Steps to Reproduce

Consider the 3 following sandboxes.

The code is exactly the same, only the react-router-dom version is changed:

Steps to reproduce (in each sandbox):

  • Click on 'Tabs'
  • Click on 'Tab 1'
  • Click on 'Tab 2'
  • Click on 'Tab 3'

Expected Behavior

The expected behavior is the one exhibited by version 6.18.0:

  • The current location pathname is "/tabs/3"
  • The active tab is Tab 3 (the text "Tab 3 content" is visible)

Actual Behavior

In version 6.19.0:

  • The current location pathname is correct "/tabs/3" ✅️
  • However the active tab is Tab 1 instead of Tab 3 (the text "Tab 1 content" is visible) ❌️

In version 6.20.0:

  • The current location pathname is wrong: "/tabs/2/3" instead of "/tabs/3" ❌️
  • The active tab is also wrong: Tab 1 instead of Tab 3 (the text "Tab 1 content" is visible) ❌️

Additional info:
We noticed that there has been some changes in 6.19.0 and 6.20.0 regarding the way splat routes are handled, but to my eyes, none of them explain this change in behaviour.

Can you please help us figure out if this is indeed a regression, or if we are doing something wrong in the way we implemented our tabs system?

Thanks.

@KubaOczko
Copy link

We have encountered the same issue. The useResolvedPath('') (the empty string parameter is the important part) is used for the current context path location, and it behaves differently since version 6.18.0.

@chinfeng
Copy link

same as #11052

@timdorr
Copy link
Member

timdorr commented Nov 24, 2023

Duplicate of #11052

@timdorr timdorr marked this as a duplicate of #11052 Nov 24, 2023
@timdorr timdorr closed this as completed Nov 24, 2023
@brophdawg11 brophdawg11 closed this as not planned Won't fix, can't repro, duplicate, stale Dec 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

6 participants
@timdorr @brophdawg11 @KubaOczko @chinfeng @slax57 and others