Skip to content

Commit

Permalink
Clear cached layout attributes if the data source counts change (#125)
Browse files Browse the repository at this point in the history
  • Loading branch information
bryankeller committed Mar 8, 2024
1 parent 63315fe commit 281c390
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions MagazineLayout/Public/MagazineLayout.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}

Expand Down

0 comments on commit 281c390

Please sign in to comment.