react-router
react-router copied to clipboard
fix: ensure consistency in generatePath/compilePath for partial splats
~~This fixes a small inconsistency in generatePath w.r.t. compilePath. We do support partial named params but at the moment we do not support partial splat params, but generatePath was permitting them. This aligns generatePath behavior and provides the same warning as compilePath~~
After chatting with @ryanflorence we decided that if possible we should look into removing that warning and supporting partial splat params (in path matching and generatePath), such the the path /prefix-* is matched by the URL /prefix-thing. This PR adds specific scoring for both partial dynamic (/prefix-:param) and partial static (/prefix-*) path segments.
There are I think 2 exiting unit tests that break, that rely on the behavior indicated by the previous warning. So want to confirm those changes with @mjackson and @ryanflorence, but otherwise everything else passes and I added a decently sized test to try to really kick the tire son the scoring algorithm and potential conflicts.
Note: Recommend viewing the PR with whitespace hidden
🦋 Changeset detected
Latest commit: 7017172fe5fc9e41aff0aefaff20d9376646775e
The changes in this PR will be included in the next version bump.
This PR includes changesets to release 5 packages
| Name | Type |
|---|---|
| react-router | Patch |
| @remix-run/router | Patch |
| react-router-dom | 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
Closing in favor of #9506