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

[v6] [Bug] Link is wrong on rerenders when using a basename #8142

Closed
AHBruns opened this issue Oct 17, 2021 · 2 comments
Closed

[v6] [Bug] Link is wrong on rerenders when using a basename #8142

AHBruns opened this issue Oct 17, 2021 · 2 comments

Comments

@AHBruns
Copy link

AHBruns commented Oct 17, 2021

Version

6.0.0-beta.6

Test Case

https://codesandbox.io/s/react-router-v6-link-w-basename-bug-report-bhyn8?file=/index.js

Go to /abc/topics/1 in the sandbox to see the issue.

Steps to reproduce

Rerender a Link without remounting it inside a Router with a basename. The link must be using a string for the to param. If it uses the object syntax it will work. No idea why those are different. There may be more, but this is all I've narrowed it down to at the moment.

Expected Behavior

The link renders the given to relative to the current basename. rerenders don't change the link's href.

Actual Behavior

Basically, every rerender the link adds the current basename onto itself, but it already has a basename, so it just grows indefinitely. E..g with basename abc
render 1: /abc/x/1
render 2: /abc/abc/x/1
render 3: /abc/abc/abc/x/1
etc...

@AHBruns AHBruns changed the title [v6] [Bug] Link generated href is wrong [v6] [Bug] Link generated href is wrong on rerenders when using a basename Oct 17, 2021
@AHBruns AHBruns changed the title [v6] [Bug] Link generated href is wrong on rerenders when using a basename [v6] [Bug] Link is wrong on rerenders when using a basename Oct 17, 2021
@fxOne
Copy link

fxOne commented Oct 18, 2021

Should be same issue as in #8133

@mjackson
Copy link
Member

Yep, this is a duplicate of #8133. Let's follow up there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants