diff --git a/native/backup/backup-handler.js b/native/backup/backup-handler.js --- a/native/backup/backup-handler.js +++ b/native/backup/backup-handler.js @@ -130,7 +130,6 @@ if ( !staffCanSee || !canPerformBackupOperation || - backupUploadInProgress.current || deviceKind === 'unknown' ) { return; @@ -144,8 +143,6 @@ } void (async () => { - backupUploadInProgress.current = true; - // CurrentIdentityUserState is required to check if migration to // new flow is needed. let currentIdentityUserState: ?CurrentIdentityUserState = null; @@ -155,7 +152,6 @@ const message = getMessageForException(err) ?? 'unknown error'; showAlertToStaff('Error fetching current device list:', message); console.log('Error fetching current device list:', message); - backupUploadInProgress.current = false; return; } @@ -164,10 +160,15 @@ !currentIdentityUserState.currentDeviceList.curPrimarySignature; if (shouldDoMigration && !socketState.isAuthorized) { - backupUploadInProgress.current = false; return; } + if (backupUploadInProgress.current) { + return; + } + + backupUploadInProgress.current = true; + if (shouldDoMigration && deviceKind === 'primary') { await performMigrationToNewFlow(currentIdentityUserState); } else if (shouldDoMigration && deviceKind === 'secondary') {