Simplify calls to setState, apparently it already shallow merges.

master
Tom Hacohen 7 years ago
parent f8ee484c3b
commit 3faa7b3ed6

@ -92,9 +92,7 @@ export class EteSyncContext extends React.Component {
errors.errorEncryptionPassword = fieldRequired;
}
if (Object.keys(errors).length) {
this.setState(Object.assign(
{}, this.state,
{errors: errors}));
this.setState({errors: errors});
return;
}
@ -127,9 +125,7 @@ export class EteSyncContext extends React.Component {
}
toggleAdvancedSettings() {
this.setState(Object.assign(
{}, this.state,
{showAdvanced: !this.state.showAdvanced}));
this.setState({showAdvanced: !this.state.showAdvanced});
}
render() {

@ -39,12 +39,12 @@ export class JournalView extends React.Component {
let journalManager = new EteSync.JournalManager(credentials, apiBase);
journalManager.fetch(journal).then((journalInstance) => {
this.setState(Object.assign({}, this.state, { journal: journalInstance }));
this.setState({ journal: journalInstance });
});
let entryManager = new EteSync.EntryManager(credentials, apiBase, journal);
entryManager.list(this.props.prevUid || null).then((entries) => {
this.setState(Object.assign({}, this.state, { entries }));
this.setState({ entries });
});
}

Loading…
Cancel
Save