Skip to content

[go_router] Fixes an issue where the params are removed after popping #3401

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

Merged
merged 2 commits into from
Mar 28, 2023

Conversation

chunhtai
Copy link
Contributor

@chunhtai chunhtai commented Mar 7, 2023

pop will remove pathparameter from routeMatchList, and the goRouterState also use the same reference to the pathparameter in the routeMatchList, thus parameters got removed as well

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.

@chunhtai chunhtai requested review from johnpryan and hannah-hyj March 7, 2023 17:40
@chunhtai chunhtai force-pushed the go-router-state-params branch 2 times, most recently from e5bd7f1 to 66fb445 Compare March 9, 2023 19:06
- Aligns Dart and Flutter SDK constraints.
- Updates compileSdkVersion to 33.
- Updates example app to iOS 11.

## 6.2.0

- Export supertypes in route_data.dart library
- Export supertypes in route_data.dart library.
Copy link
Member

Choose a reason for hiding this comment

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

Exports

router.go('/123');
await tester.pumpAndSettle();
expect(find.text('2 123'), findsOneWidget);
// The query parameter is removed, so is the location in first page.
Copy link
Member

Choose a reason for hiding this comment

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

What does this comment mean here? which query parameter and location in first page is removed?

// The query parameter is removed, so is the location in first page.
router.pop();
await tester.pump();
expect(find.text('2 123'), findsOneWidget);
Copy link
Member

Choose a reason for hiding this comment

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

I don't get why it's still at page 2 after poping.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added a comment to explain.

@chunhtai chunhtai force-pushed the go-router-state-params branch from 66fb445 to 7313652 Compare March 20, 2023 18:29
@chunhtai chunhtai requested a review from hannah-hyj March 20, 2023 18:32
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

@chunhtai chunhtai force-pushed the go-router-state-params branch from 7313652 to aa4d6a6 Compare March 27, 2023 22:58
@chunhtai chunhtai added the autosubmit Merge PR when tree becomes green via auto submit App label Mar 27, 2023
@auto-submit auto-submit bot merged commit 49e8436 into flutter:main Mar 28, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Mar 28, 2023
nploi pushed a commit to nploi/packages that referenced this pull request Jul 16, 2023
…flutter#3401)

[go_router] Fixes an issue where the params are removed after popping
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.

2 participants