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

Prevent Adding View-Backed Nodes to Layer-Backed Hierarchies #3062

Merged
merged 5 commits into from
Feb 23, 2017

Conversation

Adlai-Holler
Copy link
Contributor

Resolves #3038

Doing this will prevent required callbacks like didMoveToWindow from getting sent to our view.


for (ASDisplayNode *n in @[parent, a, b, c]) {
for (ASDisplayNode *n in @[parent, a, b, c, d]) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

These tests forgot to set layerBacked on the new subnode d so they failed our new assertion. The method name is also super confusing so I updated it.

Copy link
Contributor

@garrettmoon garrettmoon left a comment

Choose a reason for hiding this comment

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

Awesome find!

@@ -2551,6 +2551,11 @@ - (void)_insertSubnode:(ASDisplayNode *)subnode atSubnodeIndex:(NSInteger)subnod
return;
}

if (self.layerBacked && !subnode.layerBacked) {
ASDisplayNodeFailAssert(@"Cannot add a view-backed node as a subnode of a layer-backed node. Supernode: %@, subnode: %@", self, subnode);
Copy link
Contributor

Choose a reason for hiding this comment

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

I swear this type of check existed before?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think so too, but the test that failed post-change is super old so maybe not… ¯_(ツ)_/¯

Copy link
Contributor

Choose a reason for hiding this comment

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

yeah, this is really weird. The check did exist before, but I'm not sure how long ago. We should be pretty worried it vanished lol.

@Adlai-Holler Adlai-Holler merged commit 6ab92db into master Feb 23, 2017
@Adlai-Holler Adlai-Holler deleted the AHFixVisibleDeallocNumber8Million branch February 23, 2017 01:48
hannahmbanana pushed a commit that referenced this pull request Feb 23, 2017
* Prevent adding view-backed nodes to layer-backed nodes

* Do that in a different diff

* Fix the message

* Update tests

* Fix the fix
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.

4 participants