Skip to content

[Bug]: 6.8.0 Link "to" prop partial Path value results in different output url #10007

@mmaloon

Description

@mmaloon

What version of React Router are you using?

react-router-dom 6.8.0

Steps to Reproduce

When browser is at a route other than the homepage: eg: /about, passing a Path object without the pathname key results in different final href values for 6.8.0 vs 6.7.0:

In the examples, click on the "About" link then inspect the "Hash Link" and "Search Link" to see the different href valeus

// on page with route "/about"
<Link to={{ hash: 'hash' }}>Hash Link</Link>
<Link to={{ search: 'foo=bar' }}>Search Link</Link>

6.8.0 output: example

<a href="https://github.com/#hash">Hash Link</a>
<a href="https://github.com/?foo=bar">Search Link</a>

6.7.0 output: example

<a href="https://github.com/about#hash">Hash Link</a>
<a href="https://github.com/about?foo=bar">Search Link</a>

Expected Behavior

Result in same final href value on 6.8.0 as in 6.7.0

Actual Behavior

final href value is different on 6.8.0 than 6.7.0, resulting in a breaking change

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions