-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Fix collection view data inconsistency #672
Fix collection view data inconsistency #672
Conversation
@@ -638,7 +648,7 @@ - (void)rangeControllerBeginUpdates:(ASRangeController *)rangeController { | |||
- (void)rangeController:(ASRangeController *)rangeController endUpdatesAnimated:(BOOL)animated completion:(void (^)(BOOL))completion { | |||
ASDisplayNodeAssertMainThread(); | |||
|
|||
if (!self.asyncDataSource) { | |||
if (!self.asyncDataSource || _pendingReloadData) { | |||
if (completion) { | |||
completion(NO); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we call completion(YES)
if we suppressed the update due to a pending reload?
@adly-holler, this is some great detective work! The idea of simply calling layoutIfNeeded after our reloadData is very attractive indeed. (Would that actually drop this down to a 1-line commit?) You mention performance cost as a drawback to this approach, could you expand on that a bit? |
Oh yes and another question, is this a potential problem for ASTableView as well? Have you explored that side of the equation? |
@eanagel Thanks! It would indeed make this a 1-line commit, assuming that As for ASTableView, I don't think it behaves the same way but I'll check it tomorrow and post back on this thread either way. |
Fix collection view data inconsistency
Will analyze more, merging as it does fix the test project submitted recently. |
Note: Ported the sample project to table view and I'm not seeing the same issue. |
Fix by using `_superIsPendingDataLoad` introduced in facebookarchive#672
Fix by using `_superIsPendingDataLoad` introduced in facebookarchive#672
Fix by using `_superIsPendingDataLoad` introduced in facebookarchive#672
Fix by using `_superIsPendingDataLoad` introduced in facebookarchive#672
This resolves #654
We could remove the flag and just call
[self layoutIfNeeded]
immediately after[super reloadData]
UICollectionView