Repository navigation
[go_router] If there is more than one route to match, use the first match. - #1995
Conversation
|
It looks like this pull request may not have tests. Please make sure to add tests before merging. If you need an exemption to this rule, contact Hixie on the #hackers channel in Chat (don't just cc him here, he won't see it! He's on Discord!). If you are not sure if you need tests, consider this rule of thumb: the purpose of a test is to make sure someone doesn't accidentally revert the fix. Ask yourself, is there anything in your PR that you feel it is important we not accidentally revert back to how it was before your fix? Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing. |
|
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). For more information, open the CLA check for this pull request. |
chunhtai
left a comment
There was a problem hiding this comment.
It looks like there are some format change the breaks the ci. Can you revert them.
Removing the assert looks like a reasonable change, but can you add a test to verify the it does not throw if there are multiple matches?
|
build failed |
chunhtai
left a comment
There was a problem hiding this comment.
LGTM, left some comments
|
adding secondary reviewer |
Use case
If there is more than one route to match, use the first match.
The following was implemented using go_router.
I expected the following behavior.
/home/create -> CreatePage
/home/xxxx -> DetailPage ("xxxx" is some string, but exclude "create")
But I opened /home/create, go_router displayed following error.
Exception: too many routes for location: /home/create
/home => create
/home => :id
go_router uses path_to_regexp internally.
Therefore, perhaps specifying a regular expression could solve this problem. However, we felt that this would not be concise and would be a hassle for the developer.
Fixes : flutter/flutter#99833
Pre-launch Checklist
dart format.)[shared_preferences]pubspec.yamlwith an appropriate new version according to the [pub versioning philosophy], or this PR is [exempt from version changes].CHANGELOG.mdto add a description of the change, [following repository CHANGELOG style].///).