Skip to content
This repository has been archived by the owner on Feb 2, 2023. It is now read-only.

[ASDisplayNode] Fix setNeedsLayout triggered from subnode will not trigger relayout #1902

Merged
merged 1 commit into from
Jul 12, 2016
Merged

[ASDisplayNode] Fix setNeedsLayout triggered from subnode will not trigger relayout #1902

merged 1 commit into from
Jul 12, 2016

Conversation

maicki
Copy link
Contributor

@maicki maicki commented Jul 12, 2016

Current if [ASDisplayNode invalidateCalculatedLayout] and [ASDisplayNode setNeedsLayout] called in a subclass (see[ASButtonNode setTitle:]) the call actually does not trigger any relayout. It does not even bubble up the tree as it returns early in [ASDisplayNode __setNeedsDisplay]

After talking with @nguyenhuy about the initial intention why we are returning early there we found a better way for it.

This should resolve: #1865

@nguyenhuy @levi @appleguy Can I get a look over please

@nguyenhuy
Copy link
Contributor

@maicki: LGTM. Thanks for fixing this!

For the record, we want to return early only if there is no constrained size available for the coming relayout. The current check for this condition ([layout hasDirtyLayout], or !_flags.isMeasured previously) is too strict because it causes a constrained size in a dirty layout to be ignored, even though that size can be reused. @maicki and I agreed that the condition proposed in this PR is a better one.

@levi
Copy link
Contributor

levi commented Jul 12, 2016

👍👍👍

@maicki maicki changed the title [ASDisplayNode] Fix setNeedsDisplay triggered from subnode will not trigger relayout [ASDisplayNode] Fix setNeedsLayout triggered from subnode will not trigger relayout Jul 12, 2016
@maicki maicki merged commit 84029d1 into facebookarchive:master Jul 12, 2016
@suomalainen9890
Copy link

@maicki : It does work now but not 100%. Sometimes the old bug happens, probability is around 1/20.

@maicki
Copy link
Contributor Author

maicki commented Jul 12, 2016

@suomalainen9890 We are aware of it that this is not the full fix and @nguyenhuy will look into that probably later today / this week and follow up. Thanks for testing though!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[ASButtonNode] Title is truncated in ASButtonNode
4 participants