File tree Expand file tree Collapse file tree 1 file changed +7
-0
lines changed
Sources/ComposedUI/CollectionView Expand file tree Collapse file tree 1 file changed +7
-0
lines changed Original file line number Diff line number Diff line change @@ -217,6 +217,13 @@ extension CollectionCoordinator: SectionProviderMappingDelegate {
217217 public func mappingWillBeginUpdating( _ mapping: SectionProviderMapping ) {
218218 reset ( )
219219 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
220227 collectionView. layoutIfNeeded ( )
221228 }
222229
You can’t perform that action at this time.
0 commit comments