Skip to content

Promise.all for vector of requests #53

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
sirmspencer opened this issue Dec 18, 2024 · 4 comments
Open

Promise.all for vector of requests #53

sirmspencer opened this issue Dec 18, 2024 · 4 comments

Comments

@sirmspencer
Copy link

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.

@mike-thompson-day8
Copy link
Contributor

Some discussion here: day8/re-frame#808

(Not for the promise.all case.)

@sirmspencer
Copy link
Author

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.

@hipitihop
Copy link
Contributor

@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.

@sirmspencer
Copy link
Author

Thank you, I will take a look.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants