Bug report: href() and escaped periods don't work together #13795
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This pull request updates the
bug-report-test.ts
to show a failure when usinghref()
on paths that contain an escaped period.I also updated
packages\react-router\__tests__\href-test.ts
with a failing test.I'm using the file route conventions (
fs-routes
). A route that starts out like this:app\routes\text.$id[.txt].ts
is turned into a page string of"/text/:id.txt"
byreact-router typegen
.This means that this is the only type correct way to use
href()
is:But the output string is incorrect, as it is only:
/text/a123
, not/text/a123.txt
.A repository with essentially the same project as the test is available here: https://github.com/ngbrown/react-router-href-with-period
Using something like
route("text/:id.txt", "routes/text-file.ts")
also works for the routing portion, but doesn't change anything for thehref()
issue.I'm not sure on the direction of the fix... whether the team want to change just
href()
or to also change the pages strings.