-
Notifications
You must be signed in to change notification settings - Fork 27.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
Update KeepAlive.debugTypicalAncestorWidgetClass #133498
Conversation
@@ -1364,7 1367,7 @@ class KeepAlive extends ParentDataWidget<KeepAliveParentDataMixin> { | |||
bool debugCanApplyOutOfTurn() => keepAlive; | |||
|
|||
@override | |||
Type get debugTypicalAncestorWidgetClass => SliverWithKeepAliveWidget; | |||
Type get debugTypicalAncestorWidgetClass => RenderAbstractViewport; |
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 is a render object. If we really want to point out Render object, we should also update the error message, now it would show
(typically placed directly inside a RenderAbstractViewport widget)
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.
Yeah, I was wondering if that would be less than ideal. I wonder if I can get away with changing the value to a String instead of Type. Let me see if that's not a breaking change...
/// ``` | ||
/// | ||
/// If the "typical" parent is generic (`Foo<T>`), consider specifying either | ||
/// a typical type argument (e.g. `Foo<int>` if `int` is typically how the | ||
/// type is specialized), or specifying the upper bound (e.g. `Foo<Object?>`). | ||
Type get debugTypicalAncestorWidgetClass; | ||
String get debugTypicalAncestorWidgetClass; |
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.
The issue still exist, this string will be plug in to line 1635 which will always be ... xxx widgets)
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.
Oh right, thanks for checking that.
@@ -1364,7 1367,7 @@ class KeepAlive extends ParentDataWidget<KeepAliveParentDataMixin> { | |||
bool debugCanApplyOutOfTurn() => keepAlive; | |||
|
|||
@override | |||
Type get debugTypicalAncestorWidgetClass => SliverWithKeepAliveWidget; | |||
String get debugTypicalAncestorWidgetClass => 'RenderAbstractViewport widget'; |
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 sentence is still a bit confusing. Maybe Widgets that create RenderAbstractViewport
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.
SGTM! Thank you!
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.
So I tweaked this to be explicit instead. Originally I was trying to refer to the viewport as a common ancestor between 1D and 2D scrolling. But after working on another parent data change, it's really not the right error message to give someone for 1D scrolling since the viewport does not apply or use that parent data, the SliverWithKeepAliveWidget does.
@@ -1561,8 1561,7 @@ class _ActionButtonParentDataWidget | |||
} | |||
|
|||
@override | |||
Type get debugTypicalAncestorWidgetClass => | |||
_CupertinoDialogActionsRenderWidget; | |||
String get debugTypicalAncestorWidgetClass => '_CupertinoDialogActionsRenderWidget'; |
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.
You could use '$SomeClass'
instead for all these usages?
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.
Could do! I don't know if that would be reliably followed going forward since the type is just a String
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/flutter/133498, due to - The status or check suite Linux analyze has failed. Please fix the issues identified (or deflake) before re-applying this label. |
auto label is removed for flutter/flutter/133498, due to - The status or check suite Google testing has failed. Please fix the issues identified (or deflake) before re-applying this label. |
Ah unlucky, making it a String is breaking. I'll deprecate and add a dart fix in favor of a new property. 🙃 Simple change are always the trickiest. |
if you don't want to make it breaking you can do something like Type get debugTypicalAncestorWidgetClass;
String get debugTypicalAncestorWidgetClassMessage => '$debugTypicalAncestorWidgetClass widget'; |
Good idea! I will experiment with that and look at the usages in g3 a bit more. Thank you! |
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
2c77f80
to
6730861
Compare
auto label is removed for flutter/flutter/133498, due to - The status or check suite Google testing has failed. Please fix the issues identified (or deflake) before re-applying this label. |
auto label is removed for flutter/flutter/133498, due to - The status or check suite Google testing has failed. Please fix the issues identified (or deflake) before re-applying this label. |
I manually set the google testing check to green, and it undid itself for some reason. Merging manually since the autosubmit bot won't play nice. |
flutter/flutter@61b890b...58ba6c2 2023-09-14 [email protected] Roll Packages from 06cd9e9 to 275b76c (1 revision) (flutter/flutter#134734) 2023-09-14 [email protected] Update plugin_ffi generated file to match FFIgen 9.0.0 (flutter/flutter#134614) 2023-09-14 [email protected] LinkedText (Linkify) (flutter/flutter#125927) 2023-09-14 [email protected] _DayPicker should build days using separate stetefull widget _Day. (flutter/flutter#134607) 2023-09-13 31859944 [email protected] Remove `Path.combine` call from `CupertionoTextSelectionToolbar` (flutter/flutter#134369) 2023-09-13 [email protected] Update KeepAlive.debugTypicalAncestorWidgetClass (flutter/flutter#133498) 2023-09-13 84124091 [email protected] Fix null check crash by ReorderableList (flutter/flutter#132153) 2023-09-13 [email protected] Roll Flutter Engine from 154d6fd601a3 to cd90cc8469fb (3 revisions) (flutter/flutter#134691) 2023-09-13 49699333 dependabot[bot]@users.noreply.github.com Bump github/codeql-action from 2.21.5 to 2.21.6 (flutter/flutter#134692) 2023-09-13 [email protected] Roll Flutter Engine from b71b366e3de3 to 154d6fd601a3 (6 revisions) (flutter/flutter#134683) 2023-09-13 [email protected] [flutter_tools] Run ShutdownHooks when handling signals (flutter/flutter#134590) 2023-09-13 [email protected] Dispose routes in navigator when throwing exception (flutter/flutter#134596) 2023-09-13 [email protected] [framework] reduce ink sparkle uniform count. (flutter/flutter#133897) 2023-09-13 [email protected] Roll Flutter Engine from 5e671d5c90f9 to b71b366e3de3 (4 revisions) (flutter/flutter#134676) 2023-09-13 15619084 [email protected] Set the CONFIGURATION_BUILD_DIR in generated xcconfig when debugging core device (flutter/flutter#134493) 2023-09-13 [email protected] Bump gradle heap size limit in *everywhere* (flutter/flutter#134665) 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 Please CC [email protected],[email protected],[email protected] on the revert to ensure that a human is aware of the problem. To file a bug in Packages: 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
This fixes an oversight from #131641
Since KeepAlive is now supported in 2D scrolling, the debugTypicalAncestorWidgetClass was incorrect - this changes it to RenderAbstractViewport, which is true in both 1D and 2D scrolling. This is used to generate error messages when the ParentDataWidget is improperly used.
Also added some docs for KeepAlive that mention the 2D scrolling classes as supported.
Fixes #133497
Pre-launch Checklist
///
).If you need help, consider asking for advice on the #hackers-new channel on Discord.