-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix double-load issue with ASCollectionNode #372
Conversation
Source/ASCollectionNode.mm
Outdated
{ | ||
[self.view reloadDataImmediately]; | ||
[self.view relayoutItems]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I swapped the order of these two methods to group the reloadData*
methods together.
} completion:^(BOOL finished){ | ||
if (completion) { | ||
completion(); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Implementation copied from ASCollectionView
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nits aside, LGTM!
Source/ASCollectionNode.mm
Outdated
{ | ||
[self.view reloadDataImmediately]; | ||
[self.view relayoutItems]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I know the original code doesn't assert main thread and check if this node is loaded, should we do these now?
@@ -752,7 +754,8 @@ - (void)testThatSectionContextsAreCorrectAfterReloadData | |||
updateValidationTestPrologue | |||
|
|||
del.sectionGeneration++; | |||
[cv reloadDataImmediately]; | |||
[cn reloadData]; | |||
[cn waitUntilAllUpdatesAreCommitted]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No because it's deprecated.
UIWindow *window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];\ | ||
[window makeKeyAndVisible]; \ | ||
window.rootViewController = testController;\ | ||
\ | ||
[testController.collectionView reloadDataImmediately];\ | ||
[cn reloadData];\ | ||
[cn waitUntilAllUpdatesAreCommitted]; \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here, [cn reloadDataImmediately]
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No because it's deprecated.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Got it 👍
@@ -259,7 +259,8 @@ - (void)testSelection | |||
[window setRootViewController:testController]; | |||
[window makeKeyAndVisible]; | |||
|
|||
[testController.collectionView reloadDataImmediately]; | |||
[testController.collectionNode reloadData]; | |||
[testController.collectionNode waitUntilAllUpdatesAreCommitted]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't we call reloadDataImmediately
directly?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No because it's deprecated.
* Fix double-reload issue with ASCollectionNode * Add a message to the change pile * Fix some license headers * Address feedback
* Fix double-reload issue with ASCollectionNode * Add a message to the change pile * Fix some license headers * Address feedback
Resolves #351
[ASCollectionView reloadData*]
unavailable, not deprecated. This is breaking API but the methods have been deprecated for going on 7 months.reloadData
on a view that has been cast to(UICollectionView *)
but it just won't do what they expect. Nothing will actually change.[ASCollectionNode reloadData*]
to do the real work.