mirror of
https://github.com/Instagram/IGListKit
synced 2026-05-23 09:18:29 +00:00
IGListAdapter: Fix not returning early when collectionView/dataSource is nil and completion is nil
Summary: - I ran the static analyzer, and it found a case in `performUpdatesAnimated:completion:` where it looks like we meant to bail out early if the `collectionView` or `dataSource` is nil, but it only does so if `completion` is provided. - Fixed a spelling error in nearby documentation - [x] All tests pass. Demo project builds and runs. - [x] I added tests, an experiment, or detailed why my change isn't tested. - [x] I have reviewed the [contributing guide](https://github.com/Instagram/IGListKit/blob/master/CONTRIBUTING.md) - There is one other analyzer warning, but it seems to be making an incorrect assumption. In any case, it's not something I can fix quickly (requires more time spent staring at IGListDiff.mm). - A ticket should be opened to add static analysis to .travis.yml. I'lll do this soonish, unless someone beats me to it! - I could add a test for this, but this project is annotated well enough with null Closes https://github.com/Instagram/IGListKit/pull/51 Reviewed By: ocrickard Differential Revision: D4008605 Pulled By: rnystrom fbshipit-source-id: c2b7516cb8c1fc619aa63d1e9b0c26f2918cd8a1
This commit is contained in:
parent
bd72c71cd6
commit
992c3b7caa
2 changed files with 3 additions and 3 deletions
|
|
@ -103,14 +103,14 @@ IGLK_SUBCLASSING_RESTRICTED
|
|||
- (void)performUpdatesAnimated:(BOOL)animated completion:(nullable IGListUpdaterCompletion)completion;
|
||||
|
||||
/**
|
||||
Perform an immediate reload of the data in the data source, discarding the old objectss.
|
||||
Perform an immediate reload of the data in the data source, discarding the old objects.
|
||||
|
||||
@param completion A block executed when the reload completes.
|
||||
*/
|
||||
- (void)reloadDataWithCompletion:(nullable IGListUpdaterCompletion)completion;
|
||||
|
||||
/**
|
||||
Reload the infra for specific objectss only.
|
||||
Reload the infra for specific objects only.
|
||||
|
||||
@param objects The objects to reload.
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -248,8 +248,8 @@
|
|||
if (dataSource == nil || collectionView == nil) {
|
||||
if (completion) {
|
||||
completion(NO);
|
||||
return;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
NSArray *newItems = [[dataSource objectsForListAdapter:self] copy];
|
||||
|
|
|
|||
Loading…
Reference in a new issue