prodo-dev / prodo

Prodo is a React framework to build apps faster.
https://docs.prodo.dev
MIT License
115 stars 5 forks source link

Fix multiple dispatches #199

Closed tdawes closed 4 years ago

tdawes commented 4 years ago

Without this, dispatching a second action while awaiting the result of a first action would cause the first dispatch call to never resolve, since we were using a singleton on the store. This updates it so that neither dispatch call will resolve until the both are done.

Not sure if this is the best approach - thoughts?

coffee-cup commented 4 years ago

In what case were you awaiting multiple dispatches?

The watchForComplete check in the store was only there for testing and was never intended to be used in production. We never expected/wanted users of the framework to be awaiting actions (because of how the store updates).

tdawes commented 4 years ago

This wasn't a problem in production. I was triggering actions from an input's onChange callback, and as part of debugging another problem, I wanted to check that there weren't a large number of unresolved promises floating around (essentially a memory leak)

coffee-cup commented 4 years ago

ah I see. In that case, then this looks good 👍