@@ -89,7 +89,6 @@ @interface ASCollectionView () <ASRangeControllerDataSource, ASRangeControllerDe
8989 ASBatchContext *_batchContext;
9090
9191 CGSize _lastBoundsSizeUsedForMeasuringNodes;
92- BOOL _ignoreNextBoundsSizeChangeForMeasuringNodes;
9392
9493 NSMutableSet *_registeredSupplementaryKinds;
9594
@@ -272,9 +271,6 @@ - (instancetype)_initWithFrame:(CGRect)frame collectionViewLayout:(UICollectionV
272271 _superIsPendingDataLoad = YES ;
273272
274273 _lastBoundsSizeUsedForMeasuringNodes = self.bounds .size ;
275- // If the initial size is 0, expect a size change very soon which is part of the initial configuration
276- // and should not trigger a relayout.
277- _ignoreNextBoundsSizeChangeForMeasuringNodes = CGSizeEqualToSize (_lastBoundsSizeUsedForMeasuringNodes, CGSizeZero);
278274
279275 _layoutFacilitator = layoutFacilitator;
280276
@@ -1904,31 +1900,22 @@ - (void)layer:(CALayer *)layer didChangeBoundsWithOldValue:(CGRect)oldBounds new
19041900 }
19051901 _lastBoundsSizeUsedForMeasuringNodes = newBounds.size ;
19061902
1907- // First size change occurs during initial configuration. An expensive relayout pass is unnecessary at that time
1908- // and should be avoided, assuming that the initial data loading automatically runs shortly afterward.
1909- if (_ignoreNextBoundsSizeChangeForMeasuringNodes) {
1910- _ignoreNextBoundsSizeChangeForMeasuringNodes = NO ;
1911- } else {
1912- // Laying out all nodes is expensive, and performing an empty update may be unsafe
1913- // if the data source has pending changes that it hasn't reported yet – the collection
1914- // view will requery the new counts and expect them to match the previous counts.
1915- //
1916- // We only need to do this if the bounds changed in the non-scrollable direction.
1917- // If, for example, a vertical flow layout has its height changed due to a status bar
1918- // appearance update, we do not need to relayout all nodes.
1919- // For a more permanent fix to the unsafety mentioned above, see https://github.com/facebook/AsyncDisplayKit/pull/2182
1920- ASScrollDirection scrollDirection = self.scrollableDirections ;
1921- BOOL fixedVertically = (ASScrollDirectionContainsVerticalDirection (scrollDirection) == NO );
1922- BOOL fixedHorizontally = (ASScrollDirectionContainsHorizontalDirection (scrollDirection) == NO );
1923-
1924- BOOL changedInNonScrollingDirection = (fixedHorizontally && newBounds.size .width != lastUsedSize.width ) || (fixedVertically && newBounds.size .height != lastUsedSize.height );
1925-
1926- if (changedInNonScrollingDirection) {
1927- [_dataController relayoutAllNodes ];
1928- [_dataController waitUntilAllUpdatesAreCommitted ];
1929- // We need to ensure the size requery is done before we update our layout.
1930- [self .collectionViewLayout invalidateLayout ];
1931- }
1903+ // Laying out all nodes is expensive.
1904+ // We only need to do this if the bounds changed in the non-scrollable direction.
1905+ // If, for example, a vertical flow layout has its height changed due to a status bar
1906+ // appearance update, we do not need to relayout all nodes.
1907+ // For a more permanent fix to the unsafety mentioned above, see https://github.com/facebook/AsyncDisplayKit/pull/2182
1908+ ASScrollDirection scrollDirection = self.scrollableDirections ;
1909+ BOOL fixedVertically = (ASScrollDirectionContainsVerticalDirection (scrollDirection) == NO );
1910+ BOOL fixedHorizontally = (ASScrollDirectionContainsHorizontalDirection (scrollDirection) == NO );
1911+
1912+ BOOL changedInNonScrollingDirection = (fixedHorizontally && newBounds.size .width != lastUsedSize.width ) || (fixedVertically && newBounds.size .height != lastUsedSize.height );
1913+
1914+ if (changedInNonScrollingDirection) {
1915+ [_dataController relayoutAllNodes ];
1916+ [_dataController waitUntilAllUpdatesAreCommitted ];
1917+ // We need to ensure the size requery is done before we update our layout.
1918+ [self .collectionViewLayout invalidateLayout ];
19321919 }
19331920}
19341921
0 commit comments