We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 50fd5d7 commit ea9a92bCopy full SHA for ea9a92b
src/state.js
@@ -18,22 +18,16 @@ class State extends Component {
18
: props.select(this.broadcast.getState())
19
this.update = this.update.bind(this)
20
this.setStateIfNeeded = this.setStateIfNeeded.bind(this)
21
- this.isUpdating = false
22
}
23
24
update (updaterFn) {
25
if (this.props.state) {
26
this.setState(updaterFn)
27
} else {
28
- if (this.isUpdating) {
29
- throw new Error('Updaters may not invoke update function.')
30
- }
31
- this.isUpdating = true
32
const oldState = this.broadcast.getState()
33
const nextState = updaterFn(oldState)
34
this.inspect && this.inspect(oldState, nextState, updaterFn)
35
this.broadcast.setState(nextState)
36
37
38
39
0 commit comments