xxxxxxxxxx
useLayoutEffect(() => {
(async () => {
const snapshot = await getDocs(query(collection(db, 'matches', matchDetails?.id, 'messages'), where('seen', '==', false)))
snapshot.forEach(async allDoc => {
await updateDoc(doc(db, 'matches', matchDetails?.id, 'messages', allDoc?.id), {
seen: true
})
})
})()
}, [matchDetails])