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

Fix partial object (search or hash only) pathnames losing current path #10029

Merged
merged 3 commits into from
Feb 2, 2023

Conversation

brophdawg11
Copy link
Contributor

Absolute URL detection in <Link to> missed a case where the object form of to was used without a pathname, and resulted in the loss of the active pathname

Closes #10007

@changeset-bot
Copy link

changeset-bot bot commented Feb 2, 2023

🦋 Changeset detected

Latest commit: 39eecea

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 4 packages
Name Type
react-router-dom Patch
react-router Patch
react-router-dom-v5-compat Patch
react-router-native Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Comment on lines +424 to +428
if (
isBrowser &&
typeof to === "string" &&
/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i.test(to)
) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All absolute logic now only happens when to is a string and we use to unaltered as we did before in useHref and useLinkClickHandler for non-absolute URLs

Co-authored-by: Logan McAnsh <logan@remix.run>
@brophdawg11 brophdawg11 merged commit b620be2 into dev Feb 2, 2023
@brophdawg11 brophdawg11 deleted the brophdawg11/fix-partial-link-to branch February 2, 2023 19:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

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