diff --git a/Source/Common/IGListExperiments.h b/Source/Common/IGListExperiments.h index 459b7145..30048f33 100644 --- a/Source/Common/IGListExperiments.h +++ b/Source/Common/IGListExperiments.h @@ -24,6 +24,8 @@ typedef NS_OPTIONS (NSInteger, IGListExperiment) { IGListExperimentDeferredToObjectCreation = 1 << 6, /// Test getting collection view at update time. IGListExperimentGetCollectionViewAtUpdate = 1 << 7, + /// Test skipping layout when UICollectionView isn't visible + IGListExperimentSkipLayout = 1 << 8, }; /** diff --git a/Source/IGListAdapterUpdater.m b/Source/IGListAdapterUpdater.m index cfdf92bf..49e69d23 100644 --- a/Source/IGListAdapterUpdater.m +++ b/Source/IGListAdapterUpdater.m @@ -176,7 +176,10 @@ [self _cleanStateAfterUpdates]; [self _performBatchUpdatesItemBlockApplied]; [collectionView reloadData]; - [collectionView layoutIfNeeded]; + if (!IGListExperimentEnabled(self.experiments, IGListExperimentSkipLayout) + || collectionView.window != nil) { + [collectionView layoutIfNeeded]; + } executeCompletionBlocks(YES); };