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]: Route relative links not working as expected #11067

Closed
RobinClowers opened this issue Nov 28, 2023 · 2 comments
Closed

[Bug]: Route relative links not working as expected #11067

RobinClowers opened this issue Nov 28, 2023 · 2 comments
Labels

Comments

@RobinClowers
Copy link

What version of React Router are you using?

16.20.0

Steps to Reproduce

Route relative links that are nested under a splat route are not working as expected. Given a route like <Route path="/regions/:slug/*" element={<Child />} />, and a link on that route like <Link to="bar">Subpage</Link>, I would expect the first time I clicked the link to end up on /regions/foo/bar, and after than it wouldn't do anything, since I'm already at the bar relative path. This works currently in 16.18.0, but is broken in later versions.

I suspect #10983 might have caused this issue, though it's not clear why.

I've created a reproduction: https://github.com/RobinClowers/react-router-relative-link-bug, you can view it on StackBlitz if you prefer.

The main branch shows the issue, click "go to /regions/foo", then click "go to /regions/foo/bar" several times. Each time, /bar is appended to the url. If you checkout the branch "16.18.0", you will see clicking the second link doesn't cause that issue.

Expected Behavior

My app is currently using 16.18.0, and clicking a route relative link that matches the current path does nothing.

Actual Behavior

Clicking a route relative link that matches the current path appends the relative path.

@cduff
Copy link

cduff commented Nov 29, 2023

Duplicate or related to #11052?

@brophdawg11
Copy link
Contributor

Yeah, this is a duplicate of #11052 - let's track it over there

@brophdawg11 brophdawg11 closed this as not planned Won't fix, can't repro, duplicate, stale Nov 29, 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

3 participants