I've two working blocks of Promise.all() in a single method. I want to combine these two Promise.all() into one. The individual Promise.all() includes a map function that performs an asynchronous task. Example:
let obj1 = [], obj2 = [];
await Promise.all(container1.map(async (item)=>{
obj1.push(await dbCall(item));
}))
await Promise.all(container2.map(async (item)=>{
obj2.push(await dbCall(item));
}))
The above piece of block populates the dB as well as the local containers (obj1,obj2)
Whereas, including these two map functions in single Promise.all([map1,map2]) does not populate the local containers (obj1,obj2) (dB gets updated as expected)
How can I include two map functions in single Promise.all()?