diff --git a/Sources/ASCollectionView/Implementation/ASCollectionView.swift b/Sources/ASCollectionView/Implementation/ASCollectionView.swift index b3355d8a9078a169026a0c84fa03f5734425ee9d..743b2257288c91508d49999a7b1d3d666de3f17b 100644 --- a/Sources/ASCollectionView/Implementation/ASCollectionView.swift +++ b/Sources/ASCollectionView/Implementation/ASCollectionView.swift @@ -836,14 +836,17 @@ public struct ASCollectionView<SectionID: Hashable>: UIViewControllerRepresentab var lastContentSize: CGSize = .zero func didUpdateContentSize(_ size: CGSize) { - guard let cv = collectionViewController?.collectionView, cv.contentSize != lastContentSize, cv.contentSize.width != 0, cv.contentSize.height != 0 else { return } - let firstSize = lastContentSize == .zero - lastContentSize = cv.contentSize - parent.contentSizeTracker?.contentSize = size - - DispatchQueue.main.async { - self.parent.invalidateParentCellLayout?(!firstSize) - } + guard let cv = collectionViewController?.collectionView, cv.contentSize.width != .zero, cv.contentSize.height != .zero else { return } + + if cv.contentSize != lastContentSize { + let firstSize = lastContentSize == .zero + lastContentSize = cv.contentSize + parent.contentSizeTracker?.contentSize = size + + DispatchQueue.main.async { + self.parent.invalidateParentCellLayout?(!firstSize) + } + } } // MARK: Variables used for the custom prefetching implementation