fix: race condition on react HOC

This commit is contained in:
Richard Ramos 2019-10-02 22:01:17 -04:00
parent 7666d6f6a2
commit b2c49bdada
1 changed files with 7 additions and 7 deletions

View File

@ -21,16 +21,16 @@ export function observe(WrappedComponent) {
const subscription = this.props[prop].subscribe( const subscription = this.props[prop].subscribe(
value => { value => {
this.setState({ this.setState(state => ({
observedValues: { observedValues: {
...this.state.observedValues, ...state.observedValues,
[prop]: value [prop]: value
} }
}); }));
}, },
err => { err => {
// TODO: pass the error to the wrapped component // TODO: pass the error to the wrapped component
console.err(err); console.error(err);
} }
); );