mirror of
https://github.com/immich-app/immich
synced 2025-11-14 17:36:12 +00:00
fix(mobile): fix cache invalidation on logout (#1030)
await all the cache-invalidation operations during logout and catch errors to actually perform all operations.
This commit is contained in:
parent
024177515d
commit
d82dec9773
4 changed files with 18 additions and 11 deletions
|
|
@ -38,7 +38,7 @@ class AssetNotifier extends StateNotifier<List<Asset>> {
|
|||
final bool isCacheValid = await _assetCacheService.isValid();
|
||||
stopwatch.start();
|
||||
final localTask = _assetService.getLocalAssets(urgent: !isCacheValid);
|
||||
final remoteTask = _assetService.getRemoteAssets();
|
||||
final remoteTask = _assetService.getRemoteAssets(hasCache: isCacheValid);
|
||||
if (isCacheValid && state.isEmpty) {
|
||||
state = await _assetCacheService.get();
|
||||
log.info(
|
||||
|
|
|
|||
|
|
@ -23,8 +23,12 @@ abstract class JsonCache<T> {
|
|||
}
|
||||
|
||||
Future<void> invalidate() async {
|
||||
final file = await _getCacheFile();
|
||||
await file.delete();
|
||||
try {
|
||||
final file = await _getCacheFile();
|
||||
await file.delete();
|
||||
} on FileSystemException {
|
||||
// file is already deleted
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> putRawData(dynamic data) async {
|
||||
|
|
@ -46,4 +50,4 @@ abstract class JsonCache<T> {
|
|||
|
||||
void put(T data);
|
||||
Future<T> get();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue