Questions tagged [promise.all]
104 questions
0
votes
0 answers
Store response data from multiple axios get requests inside componentDidMount()
I am using promise.all inside componentdidmount to get response.data from two apis.
constructor(){
super();
this.state = {
data: [],
p1: [],
p2: []
};
}
async componentDidMount() {
const [res1,…

Shubhi Manral
- 13
- 5
0
votes
1 answer
How to handle setTimeout case while writing Polyfill for Promise.all in Javascript
I am trying to write a polyfill for Promise.all, it is working fine when I passed promises without setTimeout, but with setTimeout, I am not getting the correct results since it resolves and returns the promise before the timer expires.
How can this…

mayuri
- 135
- 3
- 14
0
votes
0 answers
My array returned prints same objects multiple times, using await Promise.all with map()
When I print the length of the array it is 3, so basically arr[0], arr[1], arr[2] contain same objects, why is that so The array returned should be of length 1 containing all the objects.
const arr = await Promise.all(
ratingsArr.map(async…

habiba
- 321
- 3
- 12
0
votes
3 answers
Retrieving SFTP listings asynchorously in Node.js
I'm trying to retrieve SFTP listings using Node, from multiple servers. I'm using the ssh2-sftp-client library, and I'm trying to handle the asynchronous connections using a futzed Promise.all().
The SFTP servers are stored in a config file…

Dycey
- 4,767
- 5
- 47
- 86
0
votes
1 answer
React Dependent API Calls
Forgive me and my lack of understanding, assuming I have gists array with following structure:
{
"description": 3,
"id": 123456,
"forks_url": "https:api.github.com..."
}
I need to get the list of gists for a user but also query the…

Omar
- 49
- 1
- 6
0
votes
1 answer
Retry multiple fetch
How do I retry this fetch x times if it fails?
The code is based on this article: https://dmitripavlutin.com/javascript-fetch-async-await/
async function fetchData() {
const [firstResponse, secondResponse] = await Promise.all([
…

Lars Bing
- 11
- 2
0
votes
0 answers
Why is my Promise.all() triggering when my Promise Chain has not been completed
I'm trying to work with a Promise.all() function in combination with a for loop where I chained multiple promises. When I have completed the iterations and for each iteration all my promises have been resolved I want the Promise.all() to…

fvb
- 1
0
votes
3 answers
converting nested promise into async/await syntax
I have a nested promise that fetches data and then presents it to the DOM.
I am trying to convert it into an async/await syntax, but because it is nested with a Promise.All I am having trouble converting it.
fetch(searchUrl)
…

Baruch Karlin
- 33
- 1
- 5
0
votes
1 answer
paginating requests to an API, using HackerNews API
*** The question is quite simple, I just wrote a lot to be specific. ***
I've been looking online for a few hours, and I can't seem to find answer. Most pagination is about after you have received the data from the API call, or for backend node.js…

Seb
- 133
- 1
- 12
0
votes
1 answer
Nodejs Promise.all not catching error/promise rejection when used with multiple map function calls
I am using Promise.all to run two separate functions which in themselves are maps running a function within a Promise.all multiple times.
async function nonBlockingWithMapAndArray(): Promise {
let arr = [100,200,150];
let arr2 =…

iamonkey
- 121
- 1
- 4
0
votes
2 answers
Create an array with multiple functions in it
How can I create an array like this:
[foo(1,3), foo(5,7)]
with Array.map to put in to a Promise.all function in node.js?
Example:
const foo = [1,2,3]
function increment(n) {
console.log(n + 1)
}
Promise.all(
foo.map(n => {
return…

Enx
- 65
- 1
- 5
0
votes
4 answers
promises.push() runs instantly and does not wait for promises.all()
I have a nodejs function processReviews(workflow) that when called, is supposed to push multiple promises to an array promises[], then run them all with promises.all() after the for loop.
function examplePromiseFunc(){
return new…

Martin
- 1,336
- 4
- 32
- 69
0
votes
1 answer
Add values from promise.all to array
I am invoking multiple api calls using Promise.all and am able to receive their responses, but I want to add them to an array
my code
async function asynchUploadGrpFiles(files) {
var responseDetails = [];
await…

Saurabh Jhunjhunwala
- 2,832
- 3
- 29
- 57
0
votes
1 answer
Getting .json is not a function on Promise.all w/fetch
Oh once again I have those Promise.all blues:( I have a function that makes an array of fetch call's from provided urls and then we want to retrieve data via a Promise.all and return array of reponses or better yet just return the promise to calling…

Alan
- 1,067
- 1
- 23
- 37
0
votes
1 answer
Rejecting from Promise.all
I have an aysnc function that fetches data and returns the value of Promise.all i.e.
const fetchDownloadMenuData = async selectedItems => {
return Promise.all(
selectedItems.map(async item => {
try {
if (item.id === 'interviewGuide') {
…

Paul
- 219
- 1
- 3
- 11