-
Notifications
You must be signed in to change notification settings - Fork 28.8k
RenderViewport max layout cycles should depend on number of slivers #144104
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
RenderViewport max layout cycles should depend on number of slivers #144104
Conversation
993f23f
to
ccab25b
Compare
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.
@@ -1399,7 +1399,7 @@ class RenderViewport extends RenderViewportBase<SliverPhysicalContainerParentDat | |||
return constraints.biggest; | |||
} | |||
|
|||
static const int _maxLayoutCycles = 10; | |||
static const int _maxLayoutCyclesPerChild = 10; |
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.
Should this be a little lower now that it is per child? Before a viewport with 3 sliver children would allow 10 passes, now it would be 30.
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 think any reasonable sliver would need more than a handful of passes, the problem is that you can have nested slivers in MultiSliver or even SliverMainAxisGroup
(but I don't think that one properly propagates scrollOffsetCorrection
?) and we have no good way to count correction count per actual source sliver. For that we would probably need changes to SliverGeometry
.
So lowering the mainLayoutCycles
could potentially be breaking change for someone that has nested slivers.
More importantly I do think that the check is meant to detect pathological cases where the layout is stuck in a loop of corrections, and as such it does matter if it is 10 passes or 30? It will throw an exception anyway so it is not something that happens during regular layout process.
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, thanks for explaining your thinking here. :)
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.
c87da01
to
7ad984f
Compare
@Piinks, seems like maybe you still need to approve the PR? :) I'll create issue for |
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 sorry about that! I had that happen a couple times last week. 🙃
7ad984f
to
ec2cfad
Compare
…lutter#144104) Fixes flutter#144102 ## Pre-launch Checklist - [x] I read the [Contributor Guide] and followed the process outlined there for submitting PRs. - [x] I read the [Tree Hygiene] wiki page, which explains my responsibilities. - [x] I read and followed the [Flutter Style Guide], including [Features we expect every widget to implement]. - [x] I signed the [CLA]. - [x] I listed at least one issue that this PR fixes in the description above. - [x] I updated/added relevant documentation (doc comments with `///`). - [x] I added new tests to check the change I am making, or this PR is [test-exempt]. - [x] I followed the [breaking change policy] and added [Data Driven Fixes] where supported. - [x] All existing and new tests are passing. If you need help, consider asking for advice on the #hackers-new channel on [Discord]. <!-- Links --> [Contributor Guide]: https://github.com/flutter/flutter/wiki/Tree-hygiene#overview [Tree Hygiene]: https://github.com/flutter/flutter/wiki/Tree-hygiene [test-exempt]: https://github.com/flutter/flutter/wiki/Tree-hygiene#tests [Flutter Style Guide]: https://github.com/flutter/flutter/wiki/Style-guide-for-Flutter-repo [Features we expect every widget to implement]: https://github.com/flutter/flutter/wiki/Style-guide-for-Flutter-repo#features-we-expect-every-widget-to-implement [CLA]: https://cla.developers.google.com/ [flutter/tests]: https://github.com/flutter/tests [breaking change policy]: https://github.com/flutter/flutter/wiki/Tree-hygiene#handling-breaking-changes [Discord]: https://github.com/flutter/flutter/wiki/Chat [Data Driven Fixes]: https://github.com/flutter/flutter/wiki/Data-driven-Fixes
Fixes #144102
Pre-launch Checklist
///
).If you need help, consider asking for advice on the #hackers-new channel on Discord.