ui: pass callback, not return value, to setState()

This commit is contained in:
Mike Salvatore 2021-02-26 08:39:49 -05:00
parent f094efba8f
commit 7079a6fd23
1 changed files with 3 additions and 4 deletions

View File

@ -355,14 +355,13 @@ class ConfigurePageComponent extends AuthComponent {
attemptSetConfigFromCandidateJson(newConfigCandidateJson){ attemptSetConfigFromCandidateJson(newConfigCandidateJson){
this.setState({lastAction: 'import_attempt', candidateConfigJson: newConfigCandidateJson}, this.setState({lastAction: 'import_attempt', candidateConfigJson: newConfigCandidateJson},
this.setConfigFromCandidateJson(newConfigCandidateJson) this.setConfigFromCandidateJson
); );
} }
setConfigFromCandidateJson(newConfigCandidateJson){ setConfigFromCandidateJson(){
try { try {
this.setState({lastAction: 'import_attempt', candidateConfigJson: newConfigCandidateJson}) let newConfig = JSON.parse(this.state.candidateConfigJson);
let newConfig = JSON.parse(newConfigCandidateJson);
if (!this.canSafelySubmitConfig(newConfig)) { if (!this.canSafelySubmitConfig(newConfig)) {
this.setState({showUnsafeOptionsConfirmation: true}); this.setState({showUnsafeOptionsConfirmation: true});