This is the code I currently have
async function getOrders() {
const querySnapshot = await getDocs(collection(db, "orders"));
querySnapshot.forEach((doc) => {
// doc.data() is never undefined for query doc snapshots
console.log(doc.id, " => ", doc.data());
});
}
When I call this function, firestore fetches twice. I put another console.log to check if I called the function twice and I didn’t. I currently have only 1 item in firestore, and it shows two (they are duplicates). Please check the code above and the pics downbelow.