-
Notifications
You must be signed in to change notification settings - Fork 49.3k
Closed
Description
If you have
componentWillReceiveProps: function() {
this.setState({x: this.state.x + 1});
this.setState({x: this.state.x + 1});
}
then x
will only be incremented once because the new state will just be stored in _pendingState
until receiveProps
finishes. After my refactoring in #115, this will never increment twice, which is probably confusing.
Maybe this isn't a bug. We can fix this behavior by instead updating this.state immediately (but still updating the UI later). Right now I can't think of any situations where having this.state out of sync with the UI is a problem.
@vjeux suggested I open an issue, so here I am. Probably easiest for me to fix while updating #115 though.