diff --git a/MagazineLayout/Public/MagazineLayout.swift b/MagazineLayout/Public/MagazineLayout.swift index 343655c..029454c 100755 --- a/MagazineLayout/Public/MagazineLayout.swift +++ b/MagazineLayout/Public/MagazineLayout.swift @@ -808,6 +808,13 @@ public final class MagazineLayout: UICollectionViewLayout { hasDataSourceCountInvalidationBeforeReceivingUpdateItems = context.invalidateDataSourceCounts && !context.invalidateEverything + if context.invalidateDataSourceCounts { + itemLayoutAttributes.removeAll() + headerLayoutAttributes.removeAll() + footerLayoutAttributes.removeAll() + backgroundLayoutAttributes.removeAll() + } + super.invalidateLayout(with: context) }