diff --git a/Source/IGListKit/IGListAdapter.m b/Source/IGListKit/IGListAdapter.m index fedb02dea..b32d8d574 100644 --- a/Source/IGListKit/IGListAdapter.m +++ b/Source/IGListKit/IGListAdapter.m @@ -427,13 +427,6 @@ - (void)performUpdatesAnimated:(BOOL)animated completion:(IGListUpdaterCompletio return; } - if (IGListExperimentEnabled(strongSelf.experiments, IGListExperimentFixCrashOnReloadObjects)) { - // All the backgroundView changes during the update will be disabled, since we don't know how - // many cells we'll really have until it's all done. As a follow up, we should probably have - // a centralized place to do this, and change the background before the animation starts. - [strongSelf _updateBackgroundViewShouldHide:![strongSelf _itemCountIsZero]]; - } - // release the previous items strongSelf.previousSectionMap = nil; [strongSelf _notifyDidUpdate:IGListAdapterUpdateTypePerformUpdates animated:animated]; @@ -770,18 +763,16 @@ - (void)_updateWithData:(IGListTransitionData *)data { [[map sectionControllerForObject:object] didUpdateToObject:object]; } - [self _updateBackgroundViewShouldHide:![self _itemCountIsZero]]; + [self _updateBackgroundView]; // Should be the last thing called in this function. _isInObjectUpdateTransaction = NO; } -- (void)_updateBackgroundViewShouldHide:(BOOL)shouldHide { - if ([self isInDataUpdateBlock]) { - return; // will be called again when update block completes - } +- (void)_updateBackgroundView { + const BOOL shouldDisplay = [self _itemCountIsZero]; - if (!shouldHide) { + if (shouldDisplay) { UIView *backgroundView = [self.dataSource emptyViewForListAdapter:self]; // don't do anything if the client is using the same view if (backgroundView != _collectionView.backgroundView) { @@ -792,7 +783,7 @@ - (void)_updateBackgroundViewShouldHide:(BOOL)shouldHide { } } - _collectionView.backgroundView.hidden = shouldHide; + _collectionView.backgroundView.hidden = !shouldDisplay; } - (BOOL)_itemCountIsZero { @@ -1298,7 +1289,7 @@ - (void)performBatchAnimated:(BOOL)animated updates:(void (^)(id