Skip to content

Fix(react-router): Generalize href to match possible routes #13797

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

Open
wants to merge 5 commits into
base: dev
Choose a base branch
from

Conversation

ngbrown
Copy link
Contributor

@ngbrown ngbrown commented Jun 13, 2025

Fixes #13795 and supersedes #13613

It is possible to have routes with an extension (/:id.txt) or with a single optional parameter (/:lang?). href() did not handle those cases correctly.

This fixes that with an implementation of href() that more closely resembles how compilePath() handles the path.

For a demonstration of the issue, see the bug-report-test.ts in #13795 or this example project.

Copy link

changeset-bot bot commented Jun 13, 2025

🦋 Changeset detected

Latest commit: f4b7fd9

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

This PR includes changesets to release 11 packages
Name Type
react-router Patch
@react-router/architect Patch
@react-router/cloudflare Patch
@react-router/dev Patch
react-router-dom Patch
@react-router/express Patch
@react-router/node Patch
@react-router/serve Patch
@react-router/fs-routes Patch
@react-router/remix-routes-option-adapter Patch
create-react-router 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

@remix-cla-bot
Copy link
Contributor

remix-cla-bot bot commented Jun 13, 2025

Thank you for signing the Contributor License Agreement. Let's get this merged! 🥳

@ngbrown ngbrown force-pushed the href-with-period-fix branch from e1316f4 to 3253ada Compare June 16, 2025 22:56
@ngbrown ngbrown force-pushed the href-with-period-fix branch from 3253ada to 5401bf0 Compare June 26, 2025 16:10
@ngbrown
Copy link
Contributor Author

ngbrown commented Jun 26, 2025

@pcattori Do you have feedback for how I implemented this fix to href()?

@ngbrown ngbrown force-pushed the href-with-period-fix branch from 5401bf0 to fcc3707 Compare July 10, 2025 00:25
@ngbrown ngbrown force-pushed the href-with-period-fix branch from fcc3707 to f4b7fd9 Compare July 16, 2025 17:57
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.

1 participant