rt2zz / redux-action-buffer

Buffer Redux Actions
MIT License
79 stars 6 forks source link

Unexpected behavior of buffer with nested dispatches #13

Open DimaSerhin opened 7 years ago

DimaSerhin commented 7 years ago

Hi. I've noticed that some of the actions are fired before releasing the queue in 1.0.1.

It happens here when the result of next is calculated.

  active = false
  var result = next(action)

The action is going deep to original dispatch and is dispatched but not returned. After that, all Redux listeners are called, in my particular case they are callbacks from React-Redux. Listeners cause some of my components to update and dispatch new actions. These new actions are handled before the queue release because flag active has been already set to false.

What I expect in this case is that these actions should be pushed to the queue and released with it even if they came after breaking condition, am I right?