mirror of
https://github.com/immich-app/immich.git
synced 2026-05-18 03:10:24 +03:00
fix(mobile): get provider refs before async gaps in backup page (#27597)
* fix(mobile): get provider refs before async gaps in backup page * fix(mobile): use previously created provider refs in start backup function
This commit is contained in:
@@ -45,14 +45,17 @@ class _DriftBackupPageState extends ConsumerState<DriftBackupPage> {
|
||||
}
|
||||
|
||||
WidgetsBinding.instance.addPostFrameCallback((_) async {
|
||||
await ref.read(driftBackupProvider.notifier).getBackupStatus(currentUser.id);
|
||||
final backupNotifier = ref.read(driftBackupProvider.notifier);
|
||||
final syncManager = ref.read(backgroundSyncProvider);
|
||||
|
||||
ref.read(driftBackupProvider.notifier).updateSyncing(true);
|
||||
syncSuccess = await ref.read(backgroundSyncProvider).syncRemote();
|
||||
ref.read(driftBackupProvider.notifier).updateSyncing(false);
|
||||
await backupNotifier.getBackupStatus(currentUser.id);
|
||||
|
||||
backupNotifier.updateSyncing(true);
|
||||
syncSuccess = await syncManager.syncRemote();
|
||||
backupNotifier.updateSyncing(false);
|
||||
|
||||
if (mounted) {
|
||||
await ref.read(driftBackupProvider.notifier).getBackupStatus(currentUser.id);
|
||||
await backupNotifier.getBackupStatus(currentUser.id);
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -82,9 +85,9 @@ class _DriftBackupPageState extends ConsumerState<DriftBackupPage> {
|
||||
}
|
||||
|
||||
if (syncSuccess == null) {
|
||||
ref.read(driftBackupProvider.notifier).updateSyncing(true);
|
||||
backupNotifier.updateSyncing(true);
|
||||
syncSuccess = await backupSyncManager.syncRemote();
|
||||
ref.read(driftBackupProvider.notifier).updateSyncing(false);
|
||||
backupNotifier.updateSyncing(false);
|
||||
}
|
||||
|
||||
await backupNotifier.getBackupStatus(currentUser.id);
|
||||
|
||||
Reference in New Issue
Block a user