Protect against individual item updates being put into an invalidated list.

This commit is contained in:
Greyson Parrelli 2021-11-22 10:40:06 -05:00
parent 1a9d785cbb
commit ef7d5d55cb

View file

@ -142,6 +142,11 @@ class FixedSizePagingController<Key, Data> implements PagingController<Key> {
return;
}
if (invalidated) {
Log.w(TAG, "Invalidated! Just before individual change was loaded for position " + position);
return;
}
Data item = dataSource.load(key);
if (item == null) {
@ -149,6 +154,11 @@ class FixedSizePagingController<Key, Data> implements PagingController<Key> {
return;
}
if (invalidated) {
Log.w(TAG, "Invalidated! Just after individual change was loaded for position " + position);
return;
}
List<Data> updatedList = new CompressedList<>(data);
updatedList.set(position, item);
@ -165,6 +175,11 @@ class FixedSizePagingController<Key, Data> implements PagingController<Key> {
return;
}
if (invalidated) {
Log.w(TAG, "Invalidated! Just before individual insert was loaded for position " + position);
return;
}
Data item = dataSource.load(key);
if (item == null) {
@ -172,6 +187,11 @@ class FixedSizePagingController<Key, Data> implements PagingController<Key> {
return;
}
if (invalidated) {
Log.w(TAG, "Invalidated! Just after individual insert was loaded for position " + position);
return;
}
List<Data> updatedList = new CompressedList<>(data);
updatedList.add(position, item);