-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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
[go_router] Relax subroute path requirements (allow root and child routes to have the same path forms ) #7647
[go_router] Relax subroute path requirements (allow root and child routes to have the same path forms ) #7647
Conversation
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). View this failed invocation of the CLA check for more information. For the most up to date status, view the checks section at the bottom of the pull request. |
20a16d8
to
0b1eef0
Compare
loc = '/$loc'; | ||
} | ||
return _pathRE.matchAsPrefix('/$loc') as RegExpMatch? ?? | ||
_pathRE.matchAsPrefix(loc) as RegExpMatch?; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here we can't predict whether or not loc
starts with /
or not as it is user defined. We could make it so the GoRoute
constructor requires all routes to start with /
but that would be a breaking change
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
@hangyujin requesting the additional necessary review |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thank you for your contribution!
Can you update the PR to resolve the conflicts |
0d143fd
to
e03887c
Compare
@hangyujin done, not sure why all previous commits were readded 9 minutes ago, I only rebased since your approval (and added a typo fix for my change in changelog). |
…d child routes to have the same path forms ) (flutter/packages#7647)
flutter/packages@429650f...05bf1d4 2024-10-04 [email protected] [various] Update Swift plugins for non-nullable generics (flutter/packages#7742) 2024-10-04 [email protected] [url_launcher] Update Android Pigeon (flutter/packages#7744) 2024-10-04 [email protected] [xdg_directories] Add `stateHome` property (flutter/packages#7766) 2024-10-03 [email protected] [file_selector] Update Android Pigeon for non-nullable generics (flutter/packages#7781) 2024-10-03 [email protected] [go_router] Relax subroute path requirements (allow root and child routes to have the same path forms ) (flutter/packages#7647) If this roll has caused a breakage, revert this CL and stop the roller using the controls here: https://autoroll.skia.org/r/flutter-packages-flutter-autoroll Please CC [email protected] on the revert to ensure that a human is aware of the problem. To file a bug in Flutter: https://github.com/flutter/flutter/issues/new/choose To report a problem with the AutoRoller itself, please file a bug: https://issues.skia.org/issues/new?component=1389291&template=1850622 Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
Before this change
GoRoute
constructor allowed Schroedinger routes which were neither in a valid state nor an invalid state until they were used. EG:GoRoute(path: '/some-route')
was valid as a top route but invalid as a child route. This prevents routes from being moved around and prevents building upon go router.To solve this I see two solution:
/
(or none)/
Since I did not want to introduce a breaking change I followed option 2, which allows all routes to be of the form
/some-route
orsome-route
. However, breaking changes aside, I believe it would be better to use solution 1 as it's more predictible.@chunhtai What do you think about those options ?
Related issue: Fix flutter/flutter#145867
Pre-launch Checklist
dart format
.)[shared_preferences]
pubspec.yaml
with an appropriate new version according to the pub versioning philosophy, or this PR is exempt from version changes.CHANGELOG.md
to add a description of the change, following repository CHANGELOG style, or this PR is exempt from CHANGELOG changes.///
).If you need help, consider asking for advice on the #hackers-new channel on Discord.