1
0
mirror of https://github.com/chinchang/web-maker.git synced 2025-07-24 07:21:14 +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) {
const prefs = { ...this.state.prefs };
Object.assign(prefs, user.settings);
this.setState({ prefs: prefs });
this.updateSetting();
this.setState({ prefs }, this.updateSetting);
}
});
} else {
@@ -230,8 +229,7 @@ export default class App extends Component {
this.createNewItem();
}
Object.assign(this.state.prefs, result);
this.setState({ prefs: { ...this.state.prefs } });
this.updateSetting();
this.setState({ prefs: { ...this.state.prefs } }, this.updateSetting);
});
// Check for new version notifications