From 4f8c4f1c6eeddc82b633a37e52e7de84a7e987d0 Mon Sep 17 00:00:00 2001 From: David Baker Date: Fri, 23 Nov 2018 10:55:18 +0000 Subject: [PATCH] Make create key backup dialog async So we can add zxcvbn to it without inflating the main bundle size --- .../views/dialogs/keybackup/CreateKeyBackupDialog.js | 0 .../dialogs/keybackup/RestoreKeyBackupDialog.js | 10 ++++++++-- src/components/views/settings/KeyBackupPanel.js | 12 +++++++----- 3 files changed, 15 insertions(+), 7 deletions(-) rename src/{components => async-components}/views/dialogs/keybackup/CreateKeyBackupDialog.js (100%) diff --git a/src/components/views/dialogs/keybackup/CreateKeyBackupDialog.js b/src/async-components/views/dialogs/keybackup/CreateKeyBackupDialog.js similarity index 100% rename from src/components/views/dialogs/keybackup/CreateKeyBackupDialog.js rename to src/async-components/views/dialogs/keybackup/CreateKeyBackupDialog.js diff --git a/src/components/views/dialogs/keybackup/RestoreKeyBackupDialog.js b/src/components/views/dialogs/keybackup/RestoreKeyBackupDialog.js index 0cce968d34..fba9f0b714 100644 --- a/src/components/views/dialogs/keybackup/RestoreKeyBackupDialog.js +++ b/src/components/views/dialogs/keybackup/RestoreKeyBackupDialog.js @@ -59,8 +59,14 @@ export default React.createClass({ _onResetRecoveryClick: function() { this.props.onFinished(false); - const CreateKeyBackupDialog = sdk.getComponent("dialogs.keybackup.CreateKeyBackupDialog"); - Modal.createTrackedDialog('Create Key Backup', '', CreateKeyBackupDialog, {}); + Modal.createTrackedDialogAsync('Key Backup', 'Key Backup', + import('../../../../async-components/views/dialogs/keybackup/CreateKeyBackupDialog'), + { + onFinished: () => { + this._loadBackupStatus(); + }, + }, + ); }, _onRecoveryKeyChange: function(e) { diff --git a/src/components/views/settings/KeyBackupPanel.js b/src/components/views/settings/KeyBackupPanel.js index 83e78787e5..b08f4d0e78 100644 --- a/src/components/views/settings/KeyBackupPanel.js +++ b/src/components/views/settings/KeyBackupPanel.js @@ -80,12 +80,14 @@ export default class KeyBackupPanel extends React.Component { } _startNewBackup() { - const CreateKeyBackupDialog = sdk.getComponent('dialogs.keybackup.CreateKeyBackupDialog'); - Modal.createTrackedDialog('Key Backup', 'Key Backup', CreateKeyBackupDialog, { - onFinished: () => { - this._loadBackupStatus(); + Modal.createTrackedDialogAsync('Key Backup', 'Key Backup', + import('../../../async-components/views/dialogs/keybackup/CreateKeyBackupDialog'), + { + onFinished: () => { + this._loadBackupStatus(); + }, }, - }); + ); } _deleteBackup() {