re-frame-http-fx
re-frame-http-fx copied to clipboard
Promise.all for vector of requests
We can optionally pass in a vector of requests instead of just one. As far as I can tell they are are independently launched and the on success is fired for each when it finished. Is there any pattern we can use to mimic a promise.all? That is the multiple calls have a single on success / on failure event that is called after all of the calls resolve.
Some discussion here: https://github.com/day8/re-frame/issues/808
(Not for the promise.all case.)
It doesn't need to actually use promise like the link you sent. The idea is that all requests should run, with a single on success event called at the end.
@sirmspencer In this situation, the current idiom is to use an https://github.com/day8/re-frame-async-flow-fx to coordinate multiple async fx. Typically you are likely to need an async flow anyway, as your list of http operations are likely just a part of and overall flow. In our case it is not unusual to engage multiple async flows like a top level :bootstrap flow which in turn kicks off a :load-assets sub flow and waits for it to complete, before it continues.
Thank you, I will take a look.