-
Notifications
You must be signed in to change notification settings - Fork 3k
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] Retain query parameter during refresh and first redirect #5276
[go_router] Retain query parameter during refresh and first redirect #5276
Conversation
WidgetsBinding.instance.platformDispatcher.defaultRouteName, | ||
); | ||
if (platformDefaultUri.hasEmptyPath) { | ||
platformDefaultUri = Uri( |
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.
this can be platformDefaultUri.replace(path: '/')
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.
That doesn't do the same.
For example, if platformDefaultUri
is https://domain.com?param=1
, my current implementation creates the Uri /?param=1
, while using Uril.replace(path: '/')
creates https://domain.com/?param=1
. This breaks a handful of tests, and I think go_router expects /?param=1
rather than https://domain.com/?param=1
?
Maybe I could change those lines into:
Uri platformDefaultUri = Uri.parse(
WidgetsBinding.instance.platformDispatcher.defaultRouteName,
);
platformDefaultUri = Uri(
path: platformDefaultUri.hasEmptyPath ? '/' platformDefaultUri.path,
queryParameters: platformDefaultUri.queryParameters,
);
final String platformDefault = platformDefaultUri.toString();
What do you think ?
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.
this will be feed into RouteInformation.location so I think you are right, we shouldn't include the scheme and host. Can you add a todo here to remind us that this can be clean up once RouteInformation.uri is available in packages repo?
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.
I added the todo in doc: Add todo
I put your username. Tell if I should put another one
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
WidgetsBinding.instance.platformDispatcher.defaultRouteName, | ||
); | ||
if (platformDefaultUri.hasEmptyPath) { | ||
platformDefaultUri = Uri( |
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.
this will be feed into RouteInformation.location so I think you are right, we shouldn't include the scheme and host. Can you add a todo here to remind us that this can be clean up once RouteInformation.uri is available in packages repo?
…y-parameters-on-refresh # Conflicts: # packages/go_router/CHANGELOG.md # packages/go_router/pubspec.yaml
…y-parameters-on-refresh # Conflicts: # packages/go_router/CHANGELOG.md # packages/go_router/pubspec.yaml
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
auto label is removed for flutter/packages/5276, due to - The status or check suite Mac_arm64 ios_platform_tests_shard_4 master has failed. Please fix the issues identified (or deflake) before re-applying this label. |
@chunhtai @Hangyujin it looks like the Mac_arm64 ios_platform_tests_shard_4 master was cancelled. Is it an issue from my changes? |
flutter/packages@b69f54e...a682189 2023-11-09 engine-flutter-autoroll@skia.org Roll Flutter from 4b4a1fe to f662150 (17 revisions) (flutter/packages#5361) 2023-11-09 32538273+ValentinVignal@users.noreply.github.com [go_router] Retain query parameter during refresh and first redirect (flutter/packages#5276) 2023-11-09 15619084+vashworth@users.noreply.github.com Use specific version of mac_toolchain (flutter/packages#5356) 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 flutter-ecosystem@google.com,rmistry@google.com 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
Fixes flutter/flutter#137513
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.///
).If you need help, consider asking for advice on the #hackers-new channel on Discord.