-
Notifications
You must be signed in to change notification settings - Fork 1.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
[ASDisplayNode+Layout] In layoutThatFits:, check and use _pending layout if valid. #413
Conversation
…out if valid. I believe this check is supposed to be here. Unit tests pass with it in place. Without it, calling layoutThatFits: (as ASDataController does) and then calling it again later (as ASCollectionNode does when answering the sizeForItem: call) will recompute the layout, potentially on main. This seems to have more of an impact / benefit for Yoga layouts, but I don't think its benefit is exclusive to them.
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.
Whoa! Makes sense to me. Explains why I'm seeing a lot of extra layout calculations for collection updates.
🚫 CI failed with log |
Generated by 🚫 Danger |
Just to be clear, the extra layout pass will occur if there is a valid pending layout but If that is the case then this diff actually makes perfect sense. I recall getting a report from a friend about extra layout passes triggered on main, in Why didn't we have catch this earlier? Or was the check there before but somehow removed? |
…out if valid. (TextureGroup#413) I believe this check is supposed to be here. Unit tests pass with it in place. Without it, calling layoutThatFits: (as ASDataController does) and then calling it again later (as ASCollectionNode does when answering the sizeForItem: call) will recompute the layout, potentially on main. This seems to have more of an impact / benefit for Yoga layouts, but I don't think its benefit is exclusive to them.
I believe this check is supposed to be here. Unit tests pass with it in place.
Without it, calling layoutThatFits: (as ASDataController does) and then calling
it again later (as ASCollectionNode does when answering the sizeForItem: call)
will recompute the layout, potentially on main.
This seems to have more of an impact / benefit for Yoga layouts, but I don't think
its benefit is exclusive to them.