Skip to content

High performance self-hosted photo and video management solution.

fix(mobile): faster device album refresh after initial sync (#17170)

shenlongc72c82c40184
diff --git a/mobile/lib/services/sync.service.dart b/mobile/lib/services/sync.service.dart
index 0f1f8d79e6..a05d4b648e 100644
--- a/mobile/lib/services/sync.service.dart
+++ b/mobile/lib/services/sync.service.dart
@@ -737,6 +737,11 @@ class SyncService {
album.thumbnail.value = thumb;
try {
await _albumRepository.create(album);
+ final int assetCount =
+ await _albumMediaRepository.getAssetCount(album.localId!);
+ await _eTagRepository.upsertAll([
+ ETag(id: album.eTagKeyAssetCount, assetCount: assetCount),
+ ]);
_log.info("Added a new local album to DB: ${album.name}");
} catch (e) {
_log.severe("Failed to add new local album ${album.name} to DB", e);