'how does snapshot with (Events for metadata changes) differs than normal snapshot in cloud firestore?

What is the main difference between using { includeMetadataChanges: true } in snapshot function and not using it at all, as I understood from docs it kind of more sensitive to change ?

import { doc, onSnapshot } from "firebase/firestore";

const unsub = onSnapshot(
  doc(db, "cities", "SF"), 
  { includeMetadataChanges: true }, 
  (doc) => {
    // ...
  });


Solution 1:[1]

When you listen for values with includeMetadataChanges: true, your callback also gets invoked when only the metadata of a snapshot has changed. Specifically this may happen when the client has verified that there were no changes on the server (so fromCache becomes true) or when local writes have been committed on the server (and so hasPendingWrites becomes false).

Without the flag, you'd not be notified of those changes, as they're not commonly shown in the UI of the app (although they definitely can be).

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Frank van Puffelen