Skip to content

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

@AHBruns

Description

@AHBruns

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...

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