From bf418476654d530bd4162e2cf977005e4a30e278 Mon Sep 17 00:00:00 2001 From: Huy Nguyen Date: Wed, 15 Mar 2017 15:55:50 +0000 Subject: [PATCH] Don't load collection/table node just to wait for updates to be committed (#3182) - Because there would be no update otherwise. --- Source/ASCollectionNode.mm | 5 ++++- Source/ASTableNode.mm | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/Source/ASCollectionNode.mm b/Source/ASCollectionNode.mm index 97bb2b8e9c..4e5fc30d05 100644 --- a/Source/ASCollectionNode.mm +++ b/Source/ASCollectionNode.mm @@ -519,7 +519,10 @@ - (void)waitUntilAllUpdatesAreCommitted { - [self.view waitUntilAllUpdatesAreCommitted]; + ASDisplayNodeAssertMainThread(); + if (self.nodeLoaded) { + [self.view waitUntilAllUpdatesAreCommitted]; + } } - (void)reloadDataWithCompletion:(void (^)())completion diff --git a/Source/ASTableNode.mm b/Source/ASTableNode.mm index 7ff5248a5f..b771744fec 100644 --- a/Source/ASTableNode.mm +++ b/Source/ASTableNode.mm @@ -653,7 +653,10 @@ ASLayoutElementCollectionTableSetTraitCollection(_environmentStateLock) - (void)waitUntilAllUpdatesAreCommitted { - [self.view waitUntilAllUpdatesAreCommitted]; + ASDisplayNodeAssertMainThread(); + if (self.nodeLoaded) { + [self.view waitUntilAllUpdatesAreCommitted]; + } } #pragma mark - Debugging (Private)