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

Update KeepAlive.debugTypicalAncestorWidgetClass #133498

Merged
merged 6 commits into from Sep 13, 2023

Conversation

Piinks
Copy link
Contributor

@Piinks Piinks commented Aug 28, 2023

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

  • 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 Flutter Style Guide, including Features we expect every widget to implement.
  • I signed the CLA.
  • I listed at least one issue that this PR fixes in the description above.
  • 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.

@Piinks Piinks added framework flutter/packages/flutter repository. See also f: labels. f: scrolling Viewports, list views, slivers, etc. d: api docs Issues with https://api.flutter.dev/ a: error message Error messages from the Flutter framework labels Aug 28, 2023
@Piinks Piinks requested a review from chunhtai August 28, 2023 20:34
@Piinks Piinks changed the title Update KeepAlive Update KeepAlive.debugTypicalAncestorWidgetClass Aug 28, 2023
@@ -1364,7 +1367,7 @@ class KeepAlive extends ParentDataWidget<KeepAliveParentDataMixin> {
bool debugCanApplyOutOfTurn() => keepAlive;

@override
Type get debugTypicalAncestorWidgetClass => SliverWithKeepAliveWidget;
Type get debugTypicalAncestorWidgetClass => RenderAbstractViewport;
Copy link
Contributor

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)

Copy link
Contributor Author

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...

@github-actions github-actions bot added the f: cupertino flutter/packages/flutter/cupertino repository label Aug 28, 2023
@Piinks Piinks requested a review from chunhtai August 28, 2023 21:22
/// ```
///
/// 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;
Copy link
Contributor

@chunhtai chunhtai Aug 28, 2023

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)

Copy link
Contributor Author

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';
Copy link
Contributor

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

SGTM! Thank you!

Copy link
Contributor Author

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';
Copy link
Contributor

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?

Copy link
Contributor Author

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

@github-actions github-actions bot added the d: examples Sample code and demos label Aug 29, 2023
@Piinks Piinks requested a review from chunhtai August 29, 2023 22:53
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

@Piinks Piinks added the autosubmit Merge PR when tree becomes green via auto submit App label Aug 29, 2023
@auto-submit auto-submit bot removed the autosubmit Merge PR when tree becomes green via auto submit App label Aug 29, 2023
@auto-submit
Copy link
Contributor

auto-submit bot commented Aug 29, 2023

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.

@Piinks Piinks added the autosubmit Merge PR when tree becomes green via auto submit App label Aug 29, 2023
@auto-submit
Copy link
Contributor

auto-submit bot commented Aug 30, 2023

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-submit auto-submit bot removed the autosubmit Merge PR when tree becomes green via auto submit App label Aug 30, 2023
@Piinks
Copy link
Contributor Author

Piinks commented Aug 30, 2023

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.

@chunhtai
Copy link
Contributor

chunhtai commented Aug 30, 2023

if you don't want to make it breaking you can do something like

Type get debugTypicalAncestorWidgetClass;

String get debugTypicalAncestorWidgetClassMessage => '$debugTypicalAncestorWidgetClass widget';

@Piinks
Copy link
Contributor Author

Piinks commented Aug 30, 2023

Good idea! I will experiment with that and look at the usages in g3 a bit more. Thank you!

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

@Piinks Piinks added the autosubmit Merge PR when tree becomes green via auto submit App label Sep 13, 2023
@auto-submit auto-submit bot removed the autosubmit Merge PR when tree becomes green via auto submit App label Sep 13, 2023
@auto-submit
Copy link
Contributor

auto-submit bot commented Sep 13, 2023

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.

@Piinks Piinks added the autosubmit Merge PR when tree becomes green via auto submit App label Sep 13, 2023
@auto-submit
Copy link
Contributor

auto-submit bot commented Sep 13, 2023

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-submit auto-submit bot removed the autosubmit Merge PR when tree becomes green via auto submit App label Sep 13, 2023
@Piinks
Copy link
Contributor Author

Piinks commented Sep 13, 2023

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.

@Piinks Piinks merged commit 2ea9edc into flutter:master Sep 13, 2023
64 of 67 checks passed
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Sep 14, 2023
auto-submit bot pushed a commit to flutter/packages that referenced this pull request Sep 14, 2023
flutter/flutter@61b890b...58ba6c2

2023-09-14 engine-flutter-autoroll@skia.org Roll Packages from 06cd9e9 to 275b76c (1 revision) (flutter/flutter#134734)
2023-09-14 dacoharkes@google.com Update plugin_ffi generated file to match FFIgen 9.0.0 (flutter/flutter#134614)
2023-09-14 jmccandless@google.com LinkedText (Linkify) (flutter/flutter#125927)
2023-09-14 polinach@google.com _DayPicker should build days using separate stetefull widget _Day. (flutter/flutter#134607)
2023-09-13 31859944+LongCatIsLooong@users.noreply.github.com Remove `Path.combine` call from `CupertionoTextSelectionToolbar` (flutter/flutter#134369)
2023-09-13 katelovett@google.com Update KeepAlive.debugTypicalAncestorWidgetClass (flutter/flutter#133498)
2023-09-13 84124091+opxdelwin@users.noreply.github.com Fix null check crash by ReorderableList (flutter/flutter#132153)
2023-09-13 engine-flutter-autoroll@skia.org 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 engine-flutter-autoroll@skia.org Roll Flutter Engine from b71b366e3de3 to 154d6fd601a3 (6 revisions) (flutter/flutter#134683)
2023-09-13 christopherfujino@gmail.com [flutter_tools] Run ShutdownHooks when handling signals (flutter/flutter#134590)
2023-09-13 jhy03261997@gmail.com Dispose routes in navigator when throwing exception (flutter/flutter#134596)
2023-09-13 jonahwilliams@google.com [framework] reduce ink sparkle uniform count. (flutter/flutter#133897)
2023-09-13 engine-flutter-autoroll@skia.org Roll Flutter Engine from 5e671d5c90f9 to b71b366e3de3 (4 revisions) (flutter/flutter#134676)
2023-09-13 15619084+vashworth@users.noreply.github.com Set the CONFIGURATION_BUILD_DIR in generated xcconfig when debugging core device (flutter/flutter#134493)
2023-09-13 zanderso@users.noreply.github.com 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 camillesimon@google.com,rmistry@google.com,stuartmorgan@google.com 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
Mairramer pushed a commit to Mairramer/flutter that referenced this pull request Oct 10, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Nov 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
a: error message Error messages from the Flutter framework d: api docs Issues with https://api.flutter.dev/ d: examples Sample code and demos f: cupertino flutter/packages/flutter/cupertino repository f: scrolling Viewports, list views, slivers, etc. framework flutter/packages/flutter repository. See also f: labels.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

KeepAlive.debugTypicalAncestorWidgetClass needs update plus docs
3 participants