-
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
[google_map_flutter] Fix map object regression due to async changes #4171
[google_map_flutter] Fix map object regression due to async changes #4171
Conversation
I think this must have gotten messed up with my federation changes: There's a circular dependency in the web version of the integration tests so we can render a real map. Maybe that test needs to be moved (actually, "made work") in the core plugin? |
I've hacked around it for now, but removing the circular dependency would definitely be better in the longer term. |
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.
.
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 don't see anything clearly wrong here, but I'm not familiar with the plugin either. Stamped with reservations. If @ditman has time to take a gander, that would be swell.
@ditman I'll plan to land this by EoD tomorrow to get the regression fix out. |
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.
Hit it! (This is so weird, though!)
await controller._updatePolygons( | ||
PolygonUpdates.from(_polygons.values.toSet(), widget.polygons)); | ||
unawaited(controller._updatePolygons( | ||
PolygonUpdates.from(_polygons.values.toSet(), widget.polygons))); |
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.
Do you have any idea on what can be improved in the plugin so it can go back to the non-unawaited
version? This feels a little bit like the plugin is relying in race conditions all the time to work!
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.
Whether the overall design of these enclosing functions not every being awaited
can be addressed without breaking changes to clients I'm not sure yet. I believe these could be fixed locally to await by changing the flow of each one to:
- copy the current value of
_foo
tooldFoo
- update
_foo
(currently done after the unawaited async) - do an
await
ed call usingoldFoo
instead of_foo
as the previous value argument.
I considered doing that in this PR, or leaving a TODO in the code to do it later, but decided that since the only current use of these private methods is from a non-async function that can't await them anyway it wasn't clear that there was a real benefit to doing so. We could certainly revisit though, since I agree it feels a bit weird.
flutter/packages@f9314a3...59d93d6 2023-06-16 [email protected] [tool] Add command aliases (flutter/packages#4207) 2023-06-16 [email protected] [google_map_flutter] Fix map object regression due to async changes (flutter/packages#4171) 2023-06-16 [email protected] [url_launcher] Add ignores for deprecated member to test (flutter/packages#4220) 2023-06-15 [email protected] Roll Flutter from 95be76a to b0188cd (10 revisions) (flutter/packages#4221) 2023-06-15 [email protected] [camera_android] Upgrading roboelectric from 4.5 to 4.10.3 (flutter/packages#4018) 2023-06-15 [email protected] [go_router] Fixes bug that GoRouterState in top level redirect doesn'� (flutter/packages#4173) 2023-06-15 [email protected] [go_router]Updates documentations around GoRouter.of, GoRouter.maybeOf, and BuildContext extension. (flutter/packages#4176) 2023-06-15 [email protected] [tool] Support code excerpts for any .md file (flutter/packages#4212) 2023-06-15 [email protected] [webview_flutter] Add support for limitsNavigationsToAppBoundDomains (flutter/packages#4026) 2023-06-15 [email protected] [webview_flutter][webview_flutter_android] Add android support for handling geolocation permissions (flutter/packages#3795) 2023-06-15 [email protected] [image_picker] add getMedia method (flutter/packages#3892) 2023-06-15 [email protected] [image_picker] getMedia platform implementations (flutter/packages#4175) 2023-06-14 [email protected] Ignore `textScaleFactor` deprecation (flutter/packages#4209) 2023-06-14 [email protected] [pigeon] Enable Obj-C integration tests in CI (flutter/packages#4215) 2023-06-14 [email protected] [flutter_adaptive_scaffold] Support RTL (flutter/packages#4204) 2023-06-14 [email protected] Manual roll Flutter from 09b7e56 to 95be76a (14 revisions) (flutter/packages#4214) 2023-06-14 [email protected] Roll Flutter (stable) from 682aa38 to 796c8ef (5 revisions) (flutter/packages#4213) 2023-06-14 [email protected] Roll Flutter from 353b8bc to 09b7e56 (17 revisions) (flutter/packages#4206) 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],[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://bugs.chromium.org/p/skia/issues/entry?template=Autoroller+Bug Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
@stuartmorgan this issue is still present at example_google_map.dart files used by iOS and Android implementation examples and integration tests; where await is used instead of unawaited causing sync issues. |
Whoops! Thanks for catching that; I'll get a PR posted shortly. |
Applies the fixes from flutter#4171 to the minimal ExampleGoogleMaps class used in the Android and iOS implementation package examples, as they had the same issue. Also sets up unit testing of the examples in order to add testing of this fix. The fake is copied directly from the app-facing package, and the unit tests are slightly modified versions of the tests in the app-facing package as well.
#4729 will fix the implementation packages. |
Applies the fixes from #4171 to the minimal ExampleGoogleMaps class used in the Android and iOS implementation package examples, as they had the same issue. Also sets up unit testing of the examples in order to add testing of this fix. The fake is copied directly from the app-facing package, and the unit tests are slightly modified versions of the tests in the app-facing package as well.
In #4067 I changed several implicitly unawaited futures to
await
, not noticing that doing so would change the timing on updating fields that were used to compute diffs for future updates. Since the update flow is unawaited at higher levels, this meant that multiple calls to update map objects in rapid succession would compute incorrect diffs due to using the wrong base objects. This fixes that by restoring the old flow usingunawaited
.Adds new tests that introduce synthetic awaits into the fake platform interface object and perform multiple updates in a row that should have different base object sets, which fail without the fix.
In order to simplify adding that behavior to the fake, and to pay down technical debt in the unit tests, I replaced the old test fake that is based on method channel interception (which predates the federation of the plugin and is implicitly relying on the method channel implementation from a different package never changing) with a fake platform interface implementation (substantially simplifying the fake).
Fixes flutter/flutter#128042
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.///
).