question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Passing an array of promises

See original GitHub issue

Currently, 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:closed
  • Created 6 years ago
  • Comments:10 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
posvacommented, Sep 27, 2018

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

1reaction
botrecommented, Mar 12, 2018

“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).

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found