Skip to content
This repository was archived by the owner on Feb 2, 2023. It is now read-only.

Commit ed9fcdc

Browse files
committed
Rebase
1 parent 30dba28 commit ed9fcdc

File tree

1 file changed

+15
-5
lines changed

1 file changed

+15
-5
lines changed

AsyncDisplayKit/Details/ASCollectionDataController.mm

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -171,11 +171,16 @@ - (void)prepareForInsertRowsAtIndexPaths:(NSArray<NSIndexPath *> *)indexPaths
171171

172172
- (void)willInsertRowsAtIndexPaths:(NSArray<NSIndexPath *> *)indexPaths
173173
{
174-
[_pendingContexts enumerateKeysAndObjectsUsingBlock:^(NSString *kind, NSMutableArray<ASIndexedNodeContext *> *contexts, BOOL *stop) {
174+
NSArray *keys = _pendingContexts.allKeys;
175+
for (NSString *kind in keys) {
176+
NSMutableArray<ASIndexedNodeContext *> *contexts = _pendingContexts[kind];
177+
175178
[self batchLayoutNodesFromContexts:contexts ofKind:kind completion:^(NSArray<ASCellNode *> *nodes, NSArray<NSIndexPath *> *indexPaths) {
176-
[self insertNodes:nodes ofKind:kind atIndexPaths:indexPaths completion:nil];
179+
[self insertNodes:nodes ofKind:kind atIndexPaths:indexPaths completion:nil];
177180
}];
178-
}];
181+
182+
[_pendingContexts removeObjectForKey:kind];
183+
}
179184
}
180185

181186
- (void)willDeleteRowsAtIndexPaths:(NSArray<NSIndexPath *> *)indexPaths
@@ -197,13 +202,18 @@ - (void)prepareForReloadRowsAtIndexPaths:(NSArray<NSIndexPath *> *)indexPaths
197202

198203
- (void)willReloadRowsAtIndexPaths:(NSArray<NSIndexPath *> *)indexPaths
199204
{
200-
[_pendingContexts enumerateKeysAndObjectsUsingBlock:^(NSString *kind, NSMutableArray<ASIndexedNodeContext *> *contexts, BOOL *stop) {
205+
NSArray *keys = _pendingContexts.allKeys;
206+
for (NSString *kind in keys) {
207+
NSMutableArray<ASIndexedNodeContext *> *contexts = _pendingContexts[kind];
208+
201209
[self deleteNodesOfKind:kind atIndexPaths:indexPaths completion:nil];
202210
// reinsert the elements
203211
[self batchLayoutNodesFromContexts:contexts ofKind:kind completion:^(NSArray<ASCellNode *> *nodes, NSArray<NSIndexPath *> *indexPaths) {
204212
[self insertNodes:nodes ofKind:kind atIndexPaths:indexPaths completion:nil];
205213
}];
206-
}];
214+
215+
[_pendingContexts removeObjectForKey:kind];
216+
}
207217
}
208218

209219
- (void)_populateSupplementaryNodesOfKind:(NSString *)kind withMutableContexts:(NSMutableArray<ASIndexedNodeContext *> *)contexts

0 commit comments

Comments
 (0)