Cooly
Cooly2y ago

Cooly – 06-37 Jan 7

await Promise.all(
comments.map((item) => {
firebase
.firestore()
.collection("users")
.doc(item.user)
.get()
.then((snap) => {
console.debug('a')
}
});
})
)
console.debug('b')
await Promise.all(
comments.map((item) => {
firebase
.firestore()
.collection("users")
.doc(item.user)
.get()
.then((snap) => {
console.debug('a')
}
});
})
)
console.debug('b')
how can i make 'a' print before 'b'?
2 Replies
ScriptyChris
ScriptyChris2y ago
You should await firebase chain call inside map
reactibot
reactibot2y ago
This thread hasn’t had any activity in 12 hours, so it’s now locked. Threads are closed automatically after 12 hours. If you have a followup question, you may want to reply to this thread so other members know they're related. https://discord.com/channels/102860784329052160/565213527673929729/1061171651187847208