Skip to content
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

Add a way to opt out of always-clear-data behavior in ASCollectionView and ASTableView #1284

Merged
merged 5 commits into from
Dec 20, 2018
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
2 changes: 1 addition & 1 deletion Schemas/configuration.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"exp_dealloc_queue_v2",
"exp_collection_teardown",
"exp_framesetter_cache",
"exp_clear_data_during_deallocation"
"exp_skip_clear_data"
]
}
}
Expand Down
12 changes: 3 additions & 9 deletions Source/ASCollectionView.mm
Original file line number Diff line number Diff line change
Expand Up @@ -581,15 +581,9 @@ - (void)_asyncDelegateOrDataSourceDidChange
{
ASDisplayNodeAssertMainThread();

if (_asyncDataSource == nil && _asyncDelegate == nil) {
if (ASActivateExperimentalFeature(ASExperimentalClearDataDuringDeallocation)) {
if (_isDeallocating) {
[_dataController clearData];
}
} else {
[_dataController clearData];
}
}
if (_asyncDataSource == nil && _asyncDelegate == nil && !ASActivateExperimentalFeature(ASExperimentalSkipClearData)) {
[_dataController clearData];
}
}

- (void)setCollectionViewLayout:(nonnull UICollectionViewLayout *)collectionViewLayout
Expand Down
2 changes: 1 addition & 1 deletion Source/ASExperimentalFeatures.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ typedef NS_OPTIONS(NSUInteger, ASExperimentalFeatures) {
ASExperimentalNetworkImageQueue = 1 << 5, // exp_network_image_queue
ASExperimentalCollectionTeardown = 1 << 6, // exp_collection_teardown
ASExperimentalFramesetterCache = 1 << 7, // exp_framesetter_cache
ASExperimentalClearDataDuringDeallocation = 1 << 8, // exp_clear_data_during_deallocation
ASExperimentalSkipClearData = 1 << 8, // exp_skip_clear_data
ASExperimentalDidEnterPreloadSkipASMLayout = 1 << 9, // exp_did_enter_preload_skip_asm_layout
ASExperimentalDisableAccessibilityCache = 1 << 10, // exp_disable_a11y_cache
ASExperimentalFeatureAll = 0xFFFFFFFF
Expand Down
2 changes: 1 addition & 1 deletion Source/ASExperimentalFeatures.mm
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
@"exp_network_image_queue",
@"exp_collection_teardown",
@"exp_framesetter_cache",
@"exp_clear_data_during_deallocation",
@"exp_skip_clear_data",
@"exp_did_enter_preload_skip_asm_layout",
@"exp_disable_a11y_cache"]));

Expand Down
10 changes: 2 additions & 8 deletions Source/ASTableView.mm
Original file line number Diff line number Diff line change
Expand Up @@ -514,14 +514,8 @@ - (void)_asyncDelegateOrDataSourceDidChange
{
ASDisplayNodeAssertMainThread();

if (_asyncDataSource == nil && _asyncDelegate == nil) {
if (ASActivateExperimentalFeature(ASExperimentalClearDataDuringDeallocation)) {
if (_isDeallocating) {
[_dataController clearData];
}
} else {
[_dataController clearData];
}
if (_asyncDataSource == nil && _asyncDelegate == nil && !ASActivateExperimentalFeature(ASExperimentalSkipClearData)) {
[_dataController clearData];
}
}

Expand Down
4 changes: 2 additions & 2 deletions Tests/ASConfigurationTests.mm
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
ASExperimentalNetworkImageQueue,
ASExperimentalCollectionTeardown,
ASExperimentalFramesetterCache,
ASExperimentalClearDataDuringDeallocation,
ASExperimentalSkipClearData,
ASExperimentalDidEnterPreloadSkipASMLayout,
ASExperimentalDisableAccessibilityCache
};
Expand All @@ -47,7 +47,7 @@ + (NSArray *)names {
@"exp_network_image_queue",
@"exp_collection_teardown",
@"exp_framesetter_cache",
@"exp_clear_data_during_deallocation",
@"exp_skip_clear_data",
@"exp_did_enter_preload_skip_asm_layout",
@"exp_disable_a11y_cache"
];
Expand Down