Use latest backup status directly rather than via state

This uses the latest backup status we just retrieved by returning from the
lookup path (instead of using it indirectly via state). This is important
because state updates are batched, so we can't rely on the value to be updated
immediately like we were.

Fixes https://github.com/vector-im/riot-web/issues/12562
pull/21833/head
J. Ryan Stinnett 2020-02-28 13:47:12 +00:00
parent b1543c4141
commit d3c7a7ff1f
1 changed files with 8 additions and 3 deletions

View File

@ -117,6 +117,11 @@ export default class CreateSecretStorageDialog extends React.PureComponent {
backupInfo, backupInfo,
backupSigStatus, backupSigStatus,
}); });
return {
backupInfo,
backupSigStatus,
};
} }
async _queryKeyUploadAuth() { async _queryKeyUploadAuth() {
@ -269,13 +274,13 @@ export default class CreateSecretStorageDialog extends React.PureComponent {
const RestoreKeyBackupDialog = sdk.getComponent('dialogs.keybackup.RestoreKeyBackupDialog'); const RestoreKeyBackupDialog = sdk.getComponent('dialogs.keybackup.RestoreKeyBackupDialog');
const { finished } = Modal.createTrackedDialog( const { finished } = Modal.createTrackedDialog(
'Restore Backup', '', RestoreKeyBackupDialog, {showSummary: false}, null, 'Restore Backup', '', RestoreKeyBackupDialog, {showSummary: false}, null,
/* priority = */ false, /* static = */ true, /* priority = */ false, /* static = */ false,
); );
await finished; await finished;
await this._fetchBackupInfo(); const { backupSigStatus } = await this._fetchBackupInfo();
if ( if (
this.state.backupSigStatus.usable && backupSigStatus.usable &&
this.state.canUploadKeysWithPasswordOnly && this.state.canUploadKeysWithPasswordOnly &&
this.state.accountPassword this.state.accountPassword
) { ) {