File tree 1 file changed +7
-0
lines changed
Sources/ComposedUI/CollectionView
1 file changed +7
-0
lines changed Original file line number Diff line number Diff line change @@ -217,6 +217,13 @@ extension CollectionCoordinator: SectionProviderMappingDelegate {
217
217
public func mappingWillBeginUpdating( _ mapping: SectionProviderMapping ) {
218
218
reset ( )
219
219
defersUpdate = true
220
+
221
+ // This is called here to ensure that the collection view's internal state is in-sync with the state of the
222
+ // data in hierarchy of sections. If this is not done it can cause various crashes when `performBatchUpdates` is called
223
+ // due to the collection view requesting data for sections that no longer exist, or crashes because the collection view is
224
+ // told to delete/insert from/into sections that it does not yet think exist.
225
+ //
226
+ // For more information on this see https://github.com/composed-swift/ComposedUI/pull/14
220
227
collectionView. layoutIfNeeded ( )
221
228
}
222
229
You can’t perform that action at this time.
0 commit comments