Skip to content
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] guard context access in then clauses #6685

Merged
merged 3 commits into from
May 7, 2024

Conversation

goderbauer
Copy link
Member

Prepares for a fix to the use_build_context_synchronously lint (https://dart-review.googlesource.com/c/sdk/+/365541) that will complain about these unsafe usages.

@goderbauer goderbauer requested a review from chunhtai as a code owner May 7, 2024 17:54
@flutter-dashboard
Copy link

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 "@test-exemption-reviewer" in the #hackers channel in Chat (don't just cc them here, they won't see it! Use 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.

@@ -72,7 +72,7 @@ class GoRouteInformationParser extends RouteInformationParser<RouteMatchList> {
return debugParserFuture = _redirect(context, matchList)
.then<RouteMatchList>((RouteMatchList value) {
if (value.isError && onParserException != null) {
return onParserException!(context, value);
return onParserException!(context, value); // ignore: use_build_context_synchronously
Copy link
Member Author

Choose a reason for hiding this comment

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

@chunhtai Here and below I am actually not sure what should happen if the context has become invalid. Do you have a suggestion?

Copy link
Contributor

Choose a reason for hiding this comment

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

if the context is invalid, it should just return a never complete future.

Something like return Completer<RouteMatchList>().future

@goderbauer
Copy link
Member Author

cc @srawlins

Copy link
Contributor

@srawlins srawlins left a comment

Choose a reason for hiding this comment

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

😁

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, can you add a todo for the ignore?

@goderbauer goderbauer added the override: no versioning needed Override the check requiring version bumps for most changes label May 7, 2024
@goderbauer
Copy link
Member Author

goderbauer commented May 7, 2024

Reason for override:

  • PRs that only affect local development of the package (e.g., changes to ignored lints).
  • PRs that only affect unpublished parts of example apps.

@goderbauer goderbauer added the autosubmit Merge PR when tree becomes green via auto submit App label May 7, 2024
Copy link
Contributor

auto-submit bot commented May 7, 2024

auto label is removed for flutter/packages/6685, due to - The status or check suite Linux repo_checks has failed. Please fix the issues identified (or deflake) before re-applying this label.

@auto-submit auto-submit bot removed the autosubmit Merge PR when tree becomes green via auto submit App label May 7, 2024
@goderbauer goderbauer removed the override: no versioning needed Override the check requiring version bumps for most changes label May 7, 2024
@goderbauer goderbauer added the autosubmit Merge PR when tree becomes green via auto submit App label May 7, 2024
@auto-submit auto-submit bot merged commit 4595c41 into flutter:main May 7, 2024
78 checks passed
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request May 8, 2024
auto-submit bot pushed a commit to flutter/flutter that referenced this pull request May 8, 2024
flutter/packages@5ccddfc...8de142d

2024-05-07 stuartmorgan@google.com [path_provider] Add Swift Package Manager support (flutter/packages#6680)
2024-05-07 goderbauer@google.com [go_router] guard context access in then clauses (flutter/packages#6685)
2024-05-07 engine-flutter-autoroll@skia.org Roll Flutter from 04424e1 to 7920a52 (27 revisions) (flutter/packages#6683)
2024-05-07 srawlins@google.com [camera] Ignore implementation imports outside of lib (flutter/packages#6191)

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
TecHaxter pushed a commit to TecHaxter/flutter_packages that referenced this pull request May 22, 2024
Prepares for a fix to the `use_build_context_synchronously` lint (https://dart-review.googlesource.com/c/sdk/+/365541) that will complain about these unsafe usages.
arc-yong pushed a commit to Arctuition/packages-arc that referenced this pull request Jun 14, 2024
Prepares for a fix to the `use_build_context_synchronously` lint (https://dart-review.googlesource.com/c/sdk/+/365541) that will complain about these unsafe usages.
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_builder p: go_router
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants