diff --git a/web/lib/firebase/utils.ts b/web/lib/firebase/utils.ts index 39f93408..b937743b 100644 --- a/web/lib/firebase/utils.ts +++ b/web/lib/firebase/utils.ts @@ -21,6 +21,8 @@ export function listenForValue( docRef: DocumentReference, setValue: (value: T | null) => void ) { + // Exclude cached snapshots so we only trigger on fresh data. + // includeMetadataChanges ensures listener is called even when server data is the same as cached data. return onSnapshot(docRef, { includeMetadataChanges: true }, (snapshot) => { if (snapshot.metadata.fromCache) return @@ -33,6 +35,8 @@ export function listenForValues( query: Query, setValues: (values: T[]) => void ) { + // Exclude cached snapshots so we only trigger on fresh data. + // includeMetadataChanges ensures listener is called even when server data is the same as cached data. return onSnapshot(query, { includeMetadataChanges: true }, (snapshot) => { if (snapshot.metadata.fromCache) return