Hey there,
I am currently building some automation scripts in conjunction with my API.
For performance reasons i would like to call multiple promises in a Promise.all function. However it seems that whenever I try to make an array of promises that by calling my async function (without await) that it already executes the fetch call to my API. Which shouldn’t happen.
let promises = records.map((record) => {
let firstPromise = asyncFunctionWithFetchCall1(record);
let secondPromise = asyncFunctionWithFetchCall2(record);
return [firstPromise, secondPromise];
});
let results = await Promise.all(promises.flat());
here firstPromise and secondPromise already execute the fetch call within the functions.
Has anyone experienced this before and is there a fix for this?
Thank you!
