Passing an array of promises
See original GitHub issueCurrently, it is possible to pass an array of promises as promises but I’m not sure the approach is flexible enough. Maybe it should be in another component that is more flexible, eg:
- An empty array displays right now as pending but it could be a specific slot
- then includes only resolved promises
- Could there be a second slot with all (also pending) promises
- get access to them with
slot-scope="{ resolved, pending, all }" - Always return all and let the user filter
- A way to reset errors
I’m open to suggestions and usecases
Issue Analytics
- State:
- Created 6 years ago
- Comments:10 (5 by maintainers)
Top Results From Across the Web
Promise.all on array of promises with parameter - Stack Overflow
Use map to call the functions and return an array of promises. Promise.all(config[name].map(callback => callback(val)) .then(values => { // executed when ...
Read more >Promise.all() - JavaScript - MDN Web Docs
The fulfillment value is an array of fulfillment values, in the order of the promises passed, regardless of completion order. If the iterable ......
Read more >All you need to know about Promise.all - freeCodeCamp
Promise.all is actually a promise that takes an array of promises as an input (an iterable). Then it gets resolved when all the...
Read more >JavaScript | Promise.all() Method - GeeksforGeeks
Parameters: This method accepts a single parameter iterable which takes an array of promises or a normal array which contains some objects.
Read more >How to Sequentially Resolve an Array of Promises in JavaScript
Sometimes you need to process an array of Promises in sequence. Here is how to do it in JavaScript with a for loop....
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

Oh no, you need to use it in the computed property. I actually think it’s a bad idea to have an extra layer of complexity for this because it hides away a very simple call regarding promises that a js developer could benefit when writing other code that deals with promises
“the result of a promise can be more than just data display”
In this case you probably shouldn’t handle the promise logic in the template layer.
I gave events a try, sending the promise to be resolved to the template layer only to then send the result back to the script layer felt convoluted (at least the way I implemented it).