Merge pull request #42 from status-im/fix/react-race-cond
fix: race condition on react HOC
This commit is contained in:
commit
d77d25b7d6
|
@ -21,16 +21,16 @@ export function observe(WrappedComponent) {
|
|||
|
||||
const subscription = this.props[prop].subscribe(
|
||||
value => {
|
||||
this.setState({
|
||||
this.setState(state => ({
|
||||
observedValues: {
|
||||
...this.state.observedValues,
|
||||
...state.observedValues,
|
||||
[prop]: value
|
||||
}
|
||||
});
|
||||
}));
|
||||
},
|
||||
err => {
|
||||
// TODO: pass the error to the wrapped component
|
||||
console.err(err);
|
||||
console.error(err);
|
||||
}
|
||||
);
|
||||
|
||||
|
|
Loading…
Reference in New Issue