Fix removed items from nextcloud album reappearing incorrectly

This commit is contained in:
Ming Ming 2024-09-26 21:47:24 +08:00
parent 936bac4f1a
commit a331383940
2 changed files with 3 additions and 14 deletions

View file

@ -33,12 +33,10 @@ part 'collection_items_controller.g.dart';
class CollectionItemStreamData {
const CollectionItemStreamData({
required this.items,
required this.rawItems,
required this.hasNext,
});
final List<CollectionItem> items;
final List<CollectionItem> rawItems;
/// If true, the results are intermediate values and may not represent the
/// latest state
@ -305,7 +303,6 @@ class CollectionItemsController {
items = r;
_dataStreamController.add(CollectionItemStreamData(
items: r,
rawItems: r,
hasNext: true,
));
}
@ -322,7 +319,6 @@ class CollectionItemsController {
items = r;
_dataStreamController.add(CollectionItemStreamData(
items: r,
rawItems: r,
hasNext: true,
));
}
@ -337,7 +333,6 @@ class CollectionItemsController {
if (items != null) {
_dataStreamController.add(CollectionItemStreamData(
items: items,
rawItems: items,
hasNext: false,
));
if (originalException == null) {
@ -362,7 +357,7 @@ class CollectionItemsController {
return;
}
await _mutex.protect(() async {
final newItems = _dataStreamController.value.rawItems
final newItems = _dataStreamController.value.items
.map((e) {
if (e is CollectionFileItem) {
final file = ev.dataMap[e.file.fdId];
@ -401,7 +396,6 @@ class CollectionItemsController {
final _dataStreamController = BehaviorSubject.seeded(
const CollectionItemStreamData(
items: [],
rawItems: [],
hasNext: true,
),
);

View file

@ -13,10 +13,7 @@ part of 'collection_items_controller.dart';
// **************************************************************************
abstract class $CollectionItemStreamDataCopyWithWorker {
CollectionItemStreamData call(
{List<CollectionItem>? items,
List<CollectionItem>? rawItems,
bool? hasNext});
CollectionItemStreamData call({List<CollectionItem>? items, bool? hasNext});
}
class _$CollectionItemStreamDataCopyWithWorkerImpl
@ -24,11 +21,9 @@ class _$CollectionItemStreamDataCopyWithWorkerImpl
_$CollectionItemStreamDataCopyWithWorkerImpl(this.that);
@override
CollectionItemStreamData call(
{dynamic items, dynamic rawItems, dynamic hasNext}) {
CollectionItemStreamData call({dynamic items, dynamic hasNext}) {
return CollectionItemStreamData(
items: items as List<CollectionItem>? ?? that.items,
rawItems: rawItems as List<CollectionItem>? ?? that.rawItems,
hasNext: hasNext as bool? ?? that.hasNext);
}