Skip to content

Commit 00aa7f3

Browse files
Fix wallet restore dialog and continue disable check (#2744)
* fix wallet restore dialog and continue disable check * Adds CHANGELOG * Change _restore to action Co-authored-by: Nikola Glumac <[email protected]>
1 parent 5335fb5 commit 00aa7f3

File tree

4 files changed

+21
-10
lines changed

4 files changed

+21
-10
lines changed

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
- Fixed issues relating to minimum window size in Daedalus ([PR 2719](https://github.com/input-output-hk/daedalus/pull/2719))
1515
- Updated "Trezor T" image shown on the "Pair a hardware wallet device" dialog ([PR 2712](https://github.com/input-output-hk/daedalus/pull/2712))
1616
- Fixed transaction timestamps localization ([PR 2702](https://github.com/input-output-hk/daedalus/pull/2702))
17-
- Small UI/UX Fixes ([PR 2685](https://github.com/input-output-hk/daedalus/pull/2685))
17+
- Small UI/UX Fixes ([PR 2685](https://github.com/input-output-hk/daedalus/pull/2685), [PR 2744](https://github.com/input-output-hk/daedalus/pull/2744))
1818

1919
### Chores
2020

source/renderer/app/containers/wallet/dialogs/wallet-restore/StepConfigurationContainer.js

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ export default class ConfigurationDialogContainer extends Component<Props> {
1515

1616
handleContinue = () => {
1717
this.props.actions.wallets.restoreWallet.trigger();
18-
this.props.actions.wallets.restoreWalletEnd.trigger();
1918
};
2019

2120
handleChange = (param: string, field: Object) =>
@@ -28,14 +27,19 @@ export default class ConfigurationDialogContainer extends Component<Props> {
2827
const { onClose, onBack, stores } = this.props;
2928
const { wallets, profile } = stores;
3029
const { currentLocale } = profile;
31-
const { error, isExecuting } = wallets.restoreRequest;
32-
const { walletName, spendingPassword, repeatPassword } = wallets;
30+
const { error } = wallets.restoreRequest;
31+
const {
32+
walletName,
33+
spendingPassword,
34+
repeatPassword,
35+
isRestoring,
36+
} = wallets;
3337
const {
3438
error: certificateError,
3539
} = stores.wallets.getWalletRecoveryPhraseFromCertificateRequest;
3640
return (
3741
<ConfigurationDialog
38-
isSubmitting={isExecuting}
42+
isSubmitting={isRestoring}
3943
onClose={onClose}
4044
onContinue={this.handleContinue}
4145
onChange={this.handleChange}

source/renderer/app/containers/wallet/dialogs/wallet-restore/StepSuccessContainer.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,10 @@ export default class SuccessDialogContainer extends Component<Props> {
1616
render() {
1717
const { stores, actions } = this.props;
1818
const { walletKindDaedalus, walletKindYoroi } = stores.wallets;
19-
const { restoreWalletClose } = actions.wallets;
19+
const { restoreWalletEnd } = actions.wallets;
2020
return (
2121
<SuccessDialog
22-
onClose={() => restoreWalletClose.trigger()}
22+
onClose={() => restoreWalletEnd.trigger()}
2323
walletKindDaedalus={walletKindDaedalus}
2424
walletKindYoroi={walletKindYoroi}
2525
/>

source/renderer/app/stores/WalletsStore.js

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,8 @@ export default class WalletsStore extends Store {
172172

173173
/* ---------- Delete Wallet ---------- */
174174
@observable isDeleting: boolean = false;
175+
/* ---------- Restore Wallet ---------- */
176+
@observable isRestoring: boolean = false;
175177

176178
/* ---------- Paper Wallet ---------- */
177179
@observable createPaperWalletCertificateStep = 0;
@@ -404,6 +406,7 @@ export default class WalletsStore extends Store {
404406
const { restoredWallet } = this;
405407
if (restoredWallet) {
406408
await this._patchWalletRequestWithNewWallet(restoredWallet);
409+
this.goToWalletRoute(restoredWallet.id);
407410
this.refreshWalletsData();
408411
this._restoreWalletResetRequests();
409412
this._restoreWalletResetData();
@@ -668,11 +671,12 @@ export default class WalletsStore extends Store {
668671
return unscrambledRecoveryPhrase;
669672
};
670673

671-
_restore = async () => {
674+
@action _restore = async () => {
675+
this.isRestoring = true;
676+
672677
// Pause polling in order to avoid fetching data for wallet we are about to restore
673678
// so that we remain on the "Add wallet" screen until user closes the TADA screen
674679
await this._pausePolling();
675-
676680
// Reset restore requests to clear previous errors
677681
this._restoreWalletResetRequests();
678682

@@ -702,8 +706,11 @@ export default class WalletsStore extends Store {
702706
this.restoredWallet = restoredWallet;
703707
this.restoreWalletStep = 3;
704708
});
705-
} catch (error) {
709+
} finally {
706710
this._resumePolling();
711+
runInAction('end wallet restore', () => {
712+
this.isRestoring = false;
713+
});
707714
}
708715
};
709716

0 commit comments

Comments
 (0)