mirror of
https://github.com/Instagram/IGListKit
synced 2026-05-14 12:58:34 +00:00
Summary: This happens when we set collectionView.dataSource to be nil before calling performUpdates:, the crash is easily reproduced by a simple unit test. To make the infra more robust and we don't crash the app, let's add an early return before applying a collectionView update. Reviewed By: rnystrom, calimarkus Differential Revision: D12896196 fbshipit-source-id: ab024d0e7e9282d50c3be297e1e67cfccaff8242
31 lines
990 B
Objective-C
31 lines
990 B
Objective-C
/**
|
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
*
|
|
* This source code is licensed under the MIT license found in the
|
|
* LICENSE file in the root directory of this source tree.
|
|
*/
|
|
|
|
#import "UICollectionView+IGListBatchUpdateData.h"
|
|
|
|
#import <IGListKit/IGListBatchUpdateData.h>
|
|
|
|
@implementation UICollectionView (IGListBatchUpdateData)
|
|
|
|
- (void)ig_applyBatchUpdateData:(IGListBatchUpdateData *)updateData {
|
|
[self deleteItemsAtIndexPaths:updateData.deleteIndexPaths];
|
|
[self insertItemsAtIndexPaths:updateData.insertIndexPaths];
|
|
[self reloadItemsAtIndexPaths:updateData.updateIndexPaths];
|
|
|
|
for (IGListMoveIndexPath *move in updateData.moveIndexPaths) {
|
|
[self moveItemAtIndexPath:move.from toIndexPath:move.to];
|
|
}
|
|
|
|
for (IGListMoveIndex *move in updateData.moveSections) {
|
|
[self moveSection:move.from toSection:move.to];
|
|
}
|
|
|
|
[self deleteSections:updateData.deleteSections];
|
|
[self insertSections:updateData.insertSections];
|
|
}
|
|
|
|
@end
|