Skip to content

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.

@changeset-bot
Copy link

changeset-bot bot commented Jun 13, 2025

🦋 Changeset detected

Latest commit: 4997ef8

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 2 times, most recently from fcc3707 to f4b7fd9 Compare July 16, 2025 17:57
@ngbrown ngbrown force-pushed the href-with-period-fix branch from f4b7fd9 to 179b526 Compare July 16, 2025 21:10
@ngbrown ngbrown changed the title Fix(react-router): Generalize href to match possible routes Fix(react-router): Correct href() to processes routes that have an extension after the parameter or are a single optional parameter Jul 21, 2025
@pcattori pcattori self-assigned this Jul 21, 2025
@ngbrown
Copy link
Contributor Author

ngbrown commented Aug 11, 2025

@timdorr and @pcattori, is this something that can be reviewed soon? If @pcattori is too busy, maybe someone else can review it?

@pcattori pcattori merged commit 813a935 into remix-run:dev Aug 27, 2025
5 checks passed
@ngbrown ngbrown deleted the href-with-period-fix branch August 28, 2025 17:03
@github-actions
Copy link
Contributor

github-actions bot commented Sep 9, 2025

🤖 Hello there,

We just published version 7.9.0-pre.0 which includes this pull request. If you'd like to take it for a test run please try it out and let us know what you think!

Thanks!

@github-actions
Copy link
Contributor

🤖 Hello there,

We just published version 7.9.0 which includes this pull request. If you'd like to take it for a test run please try it out and let us know what you think!

Thanks!

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.

3 participants