From 7079a6fd232d8bda028a24295d1a41d787eac962 Mon Sep 17 00:00:00 2001 From: Mike Salvatore Date: Fri, 26 Feb 2021 08:39:49 -0500 Subject: [PATCH] ui: pass callback, not return value, to setState() --- .../cc/ui/src/components/pages/ConfigurePage.js | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/monkey/monkey_island/cc/ui/src/components/pages/ConfigurePage.js b/monkey/monkey_island/cc/ui/src/components/pages/ConfigurePage.js index c04fdeb93..b3c509bec 100644 --- a/monkey/monkey_island/cc/ui/src/components/pages/ConfigurePage.js +++ b/monkey/monkey_island/cc/ui/src/components/pages/ConfigurePage.js @@ -355,14 +355,13 @@ class ConfigurePageComponent extends AuthComponent { attemptSetConfigFromCandidateJson(newConfigCandidateJson){ this.setState({lastAction: 'import_attempt', candidateConfigJson: newConfigCandidateJson}, - this.setConfigFromCandidateJson(newConfigCandidateJson) + this.setConfigFromCandidateJson ); } - setConfigFromCandidateJson(newConfigCandidateJson){ + setConfigFromCandidateJson(){ try { - this.setState({lastAction: 'import_attempt', candidateConfigJson: newConfigCandidateJson}) - let newConfig = JSON.parse(newConfigCandidateJson); + let newConfig = JSON.parse(this.state.candidateConfigJson); if (!this.canSafelySubmitConfig(newConfig)) { this.setState({showUnsafeOptionsConfirmation: true});