Fix logic cleaning data if delegate / dataSource changes and bring over logic to ASTableView (#1200)

* Cleanup in ASTableView datasource/delegate change

* Fix experiments logic

* Add changelog entry
This commit is contained in:
Michael Schneider 2018-11-01 08:08:45 -07:00 committed by GitHub
parent 055d27c45a
commit fec14f8310
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 28 additions and 4 deletions

View File

@ -69,6 +69,7 @@
- Yoga integration improvements [Michael Schneider](https://github.com/maicki)[#1187] (https://github.com/TextureGroup/Texture/pull/1187)
- Correct linePositionModifier behavior [Michael Schneider](https://github.com/maicki)[#1192] (https://github.com/TextureGroup/Texture/pull/1192)
- Tweak a11y label aggregation behavior to enable container label overrides [Michael Schneider](https://github.com/maicki)[#1199] (https://github.com/TextureGroup/Texture/pull/1199)
- Fix logic cleaning data if delegate / dataSource changes and bring over logic to ASTableView [Michael Schneider](https://github.com/maicki)[#1200] (https://github.com/TextureGroup/Texture/pull/1200)
## 2.7
- Fix pager node for interface coalescing. [Max Wang](https://github.com/wsdwsd0829) [#877](https://github.com/TextureGroup/Texture/pull/877)

View File

@ -576,10 +576,16 @@ static NSString * const kReuseIdentifier = @"_ASCollectionReuseIdentifier";
- (void)_asyncDelegateOrDataSourceDidChange
{
ASDisplayNodeAssertMainThread();
if (_asyncDataSource == nil && _asyncDelegate == nil && _isDeallocating && ASActivateExperimentalFeature(ASExperimentalClearDataDuringDeallocation)) {
[_dataController clearData];
}
if (_asyncDataSource == nil && _asyncDelegate == nil) {
if (ASActivateExperimentalFeature(ASExperimentalClearDataDuringDeallocation)) {
if (_isDeallocating) {
[_dataController clearData];
}
} else {
[_dataController clearData];
}
}
}
- (void)setCollectionViewLayout:(nonnull UICollectionViewLayout *)collectionViewLayout

View File

@ -436,6 +436,7 @@ static NSString * const kCellReuseIdentifier = @"_ASTableViewCell";
_dataController.validationErrorSource = asyncDataSource;
super.dataSource = (id<UITableViewDataSource>)_proxyDataSource;
[self _asyncDelegateOrDataSourceDidChange];
}
- (id<ASTableDelegate>)asyncDelegate
@ -506,6 +507,22 @@ static NSString * const kCellReuseIdentifier = @"_ASTableViewCell";
}
super.delegate = (id<UITableViewDelegate>)_proxyDelegate;
[self _asyncDelegateOrDataSourceDidChange];
}
- (void)_asyncDelegateOrDataSourceDidChange
{
ASDisplayNodeAssertMainThread();
if (_asyncDataSource == nil && _asyncDelegate == nil) {
if (ASActivateExperimentalFeature(ASExperimentalClearDataDuringDeallocation)) {
if (_isDeallocating) {
[_dataController clearData];
}
} else {
[_dataController clearData];
}
}
}
- (void)proxyTargetHasDeallocated:(ASDelegateProxy *)proxy