Skip to content
This repository was archived by the owner on Feb 2, 2023. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions Source/ASCollectionView.mm
Original file line number Diff line number Diff line change
Expand Up @@ -362,10 +362,6 @@ - (void)waitUntilAllUpdatesAreCommitted
}

[_dataController waitUntilAllUpdatesAreCommitted];

// reloadData of UICollectionView doesn't requery its data source but defers until the next layout pass.
// A forced layout pass is neccessary here to make sure everything is ready after this method returns.
[self layoutIfNeeded];
}

- (void)setDataSource:(id<UICollectionViewDataSource>)dataSource
Expand Down
9 changes: 9 additions & 0 deletions Tests/ASCollectionViewTests.mm
Original file line number Diff line number Diff line change
Expand Up @@ -827,6 +827,7 @@ - (void)testThatDeletedItemsAreMarkedInvisible

ASCollectionNode *cn = testController.collectionNode;
[cn waitUntilAllUpdatesAreCommitted];
[cn.view layoutIfNeeded];
ASCellNode *node = [cn nodeForItemAtIndexPath:[NSIndexPath indexPathForItem:0 inSection:0]];
XCTAssertTrue(node.visible);
testController.asyncDelegate->_itemCounts = {0};
Expand Down Expand Up @@ -984,9 +985,13 @@ - (void)_primitiveBatchFetchingFillTestAnimated:(BOOL)animated visible:(BOOL)vis
window.rootViewController = testController;

[window makeKeyAndVisible];
// Trigger the initial reload to start
[view layoutIfNeeded];

// Wait for ASDK reload to finish
[cn waitUntilAllUpdatesAreCommitted];
// Force UIKit to read updated data & range controller to update and account for it
[cn.view layoutIfNeeded];
[self waitForExpectationsWithTimeout:60 handler:nil];

CGFloat contentHeight = cn.view.contentSize.height;
Expand All @@ -1011,9 +1016,13 @@ - (void)testInitialRangeBounds
window.rootViewController = testController;

[window makeKeyAndVisible];
// Trigger the initial reload to start
[window layoutIfNeeded];

// Wait for ASDK reload to finish
[cn waitUntilAllUpdatesAreCommitted];
// Force UIKit to read updated data & range controller to update and account for it
[cn.view layoutIfNeeded];

CGRect preloadBounds = ({
CGRect r = CGRectNull;
Expand Down