Add comment for includeMetadataChanges.
This commit is contained in:
parent
45d322cfd3
commit
5d5a1860b5
|
@ -21,6 +21,8 @@ export function listenForValue<T>(
|
|||
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<T>(
|
|||
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
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user