You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
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.
The text was updated successfully, but these errors were encountered:
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 thebar
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.
The text was updated successfully, but these errors were encountered: