From 8c3215ac51c7cf6bd0b46cd4631ec2acda766df6 Mon Sep 17 00:00:00 2001 From: bbaa77770 <444693295@qq.com> Date: Tue, 15 Dec 2020 16:53:54 +0800 Subject: [PATCH 1/2] Fix: Reset macros in config settings --- src/app/containers/Settings/Settings.jsx | 5 ++--- src/app/flux/setting/index.js | 11 +++++++++++ 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/src/app/containers/Settings/Settings.jsx b/src/app/containers/Settings/Settings.jsx index 30509461bb..1e05535db9 100644 --- a/src/app/containers/Settings/Settings.jsx +++ b/src/app/containers/Settings/Settings.jsx @@ -119,10 +119,9 @@ class Settings extends PureComponent { confirm({ title: i18n._('Reset All User Settings'), body: i18n._('Are you sure you want to restore the default settings?') - }).then(() => { - this.props.resetAllUserSettings(); + }).then(this.props.resetAllUserSettings().then(() => { window.location.reload(); - }); + })); } }, // About diff --git a/src/app/flux/setting/index.js b/src/app/flux/setting/index.js index 0fd784667e..67a3d8b1b5 100644 --- a/src/app/flux/setting/index.js +++ b/src/app/flux/setting/index.js @@ -6,6 +6,17 @@ import { actions as projectActions } from '../project'; export const actions = { resetAllUserSettings: () => async (dispatch) => { + // macros + try { + let res = await api.macros.fetch(); + const { records: macros } = res.body; + for (const macro of macros) { + res = await api.macros.delete(macro.id); + } + } catch (err) { + //Ignore error + } + // api.removeElectronData(); dispatch(projectActions.cleanAllRecentFiles()); // remove recovery modelState From 85a0178794090acee438719681d8a8eea8944ecc Mon Sep 17 00:00:00 2001 From: bbaa77770 <444693295@qq.com> Date: Wed, 16 Dec 2020 16:03:37 +0800 Subject: [PATCH 2/2] Fix: Change the writing of async functions --- src/app/containers/Settings/Settings.jsx | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/app/containers/Settings/Settings.jsx b/src/app/containers/Settings/Settings.jsx index 1e05535db9..03cd281bb7 100644 --- a/src/app/containers/Settings/Settings.jsx +++ b/src/app/containers/Settings/Settings.jsx @@ -115,13 +115,13 @@ class Settings extends PureComponent { }, // Workspace config: { - restoreDefaults: () => { - confirm({ + restoreDefaults: async () => { + await confirm({ title: i18n._('Reset All User Settings'), body: i18n._('Are you sure you want to restore the default settings?') - }).then(this.props.resetAllUserSettings().then(() => { - window.location.reload(); - })); + }); + await this.props.resetAllUserSettings(); + window.location.reload(); } }, // About