Skip to content

Conversation

@ValentinVignal
Copy link
Contributor

Fixes flutter/flutter#137513

Pre-launch Checklist

  • I read the Contributor Guide and followed the process outlined there for submitting PRs.
  • I read the Tree Hygiene wiki page, which explains my responsibilities.
  • I read and followed the relevant style guides and ran the auto-formatter. (Unlike the flutter/flutter repo, the flutter/packages repo does use dart format.)
  • I signed the CLA.
  • The title of the PR starts with the name of the package surrounded by square brackets, e.g. [shared_preferences]
  • I listed at least one issue that this PR fixes in the description above.
  • I updated pubspec.yaml with an appropriate new version according to the pub versioning philosophy, or this PR is exempt from version changes.
  • I updated CHANGELOG.md to add a description of the change, following repository CHANGELOG style.
  • I updated/added relevant documentation (doc comments with ///).
  • I added new tests to check the change I am making, or this PR is test-exempt.
  • All existing and new tests are passing.

If you need help, consider asking for advice on the #hackers-new channel on Discord.

WidgetsBinding.instance.platformDispatcher.defaultRouteName,
);
if (platformDefaultUri.hasEmptyPath) {
platformDefaultUri = Uri(
Copy link
Contributor

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: '/')

Copy link
Contributor Author

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 ?

Copy link
Contributor

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?

Copy link
Contributor Author

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

Copy link
Contributor

@chunhtai chunhtai left a 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(
Copy link
Contributor

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?

@chunhtai chunhtai requested a review from hannah-hyj November 2, 2023 22:01
…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
Copy link
Member

@hannah-hyj hannah-hyj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@hannah-hyj hannah-hyj added the autosubmit Merge PR when tree becomes green via auto submit App label Nov 7, 2023
@auto-submit auto-submit bot removed the autosubmit Merge PR when tree becomes green via auto submit App label Nov 7, 2023
@auto-submit
Copy link
Contributor

auto-submit bot commented Nov 7, 2023

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.

@ValentinVignal
Copy link
Contributor Author

@chunhtai @Hangyujin it looks like the Mac_arm64 ios_platform_tests_shard_4 master was cancelled. Is it an issue from my changes?

@chunhtai chunhtai added the autosubmit Merge PR when tree becomes green via auto submit App label Nov 9, 2023
@auto-submit auto-submit bot merged commit 5929d66 into flutter:main Nov 9, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Nov 10, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Nov 10, 2023
auto-submit bot pushed a commit to flutter/flutter that referenced this pull request Nov 10, 2023
@reidbaker reidbaker mentioned this pull request Jan 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

autosubmit Merge PR when tree becomes green via auto submit App p: go_router

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[go_router] GoRouter remove query parameter when app loaded/refreshed

3 participants