mirror of
https://github.com/immich-app/immich.git
synced 2025-05-31 12:15:47 -04:00
fix(mobile): ignore invalid store keys (#17370)
Co-authored-by: shenlong-tanwen <139912620+shalong-tanwen@users.noreply.github.com>
This commit is contained in:
parent
60174d662d
commit
dfab32c8f2
@ -9,7 +9,9 @@ import 'package:isar/isar.dart';
|
|||||||
class IsarStoreRepository extends IsarDatabaseRepository
|
class IsarStoreRepository extends IsarDatabaseRepository
|
||||||
implements IStoreRepository {
|
implements IStoreRepository {
|
||||||
final Isar _db;
|
final Isar _db;
|
||||||
const IsarStoreRepository(super.db) : _db = db;
|
final validStoreKeys = StoreKey.values.map((e) => e.id).toSet();
|
||||||
|
|
||||||
|
IsarStoreRepository(super.db) : _db = db;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Future<bool> deleteAll() async {
|
Future<bool> deleteAll() async {
|
||||||
@ -21,9 +23,14 @@ class IsarStoreRepository extends IsarDatabaseRepository
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Stream<StoreUpdateEvent> watchAll() {
|
Stream<StoreUpdateEvent> watchAll() {
|
||||||
return _db.storeValues.where().watch(fireImmediately: true).asyncExpand(
|
return _db.storeValues
|
||||||
(entities) =>
|
.filter()
|
||||||
Stream.fromFutures(entities.map((e) async => _toUpdateEvent(e))),
|
.anyOf(validStoreKeys, (query, id) => query.idEqualTo(id))
|
||||||
|
.watch(fireImmediately: true)
|
||||||
|
.asyncExpand(
|
||||||
|
(entities) => Stream.fromFutures(
|
||||||
|
entities.map((e) async => _toUpdateEvent(e)),
|
||||||
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user