1
0
mirror of https://github.com/chinchang/web-maker.git synced 2025-07-26 08:11:17 +02:00

take care of setState asyncness

This commit is contained in:
Kushagra Gour
2019-07-17 11:51:13 +05:30
parent 6ffb623ece
commit e21dbdf70f

View File

@@ -179,8 +179,7 @@ export default class App extends Component {
if (customUser) { if (customUser) {
const prefs = { ...this.state.prefs }; const prefs = { ...this.state.prefs };
Object.assign(prefs, user.settings); Object.assign(prefs, user.settings);
this.setState({ prefs: prefs }); this.setState({ prefs }, this.updateSetting);
this.updateSetting();
} }
}); });
} else { } else {
@@ -230,8 +229,7 @@ export default class App extends Component {
this.createNewItem(); this.createNewItem();
} }
Object.assign(this.state.prefs, result); Object.assign(this.state.prefs, result);
this.setState({ prefs: { ...this.state.prefs } }); this.setState({ prefs: { ...this.state.prefs } }, this.updateSetting);
this.updateSetting();
}); });
// Check for new version notifications // Check for new version notifications