jumpsuit / jumpstate

Jumpstate is a simple and powerful state management utility for Redux.
MIT License
425 stars 22 forks source link

Tightly triggered Effects need unique IDs to all resolve #27

Closed codinronan closed 7 years ago

codinronan commented 7 years ago

Description

Let's say you have two effects:

Effect('effect1', () => { return Actions.effect2() }) Effect('effect2', () => { return Promise.resolve(true) })

And you call them in this manner:

Actions.effect1();

Because the two actions are created in a tight loop, the unique id created to keep track of the effects, being a Date.now(), was not unique - this is sub-millisecond execution. The result is that effect1 does not resolve.

This commit does the following:

@tannerlinsley I would like your feedback on the test - if you have a different idea for how to instantiate the Redux store so that the test can execute.