Firestore Does Not Notify Removed Change Type When Querying Documents
Solution 1:
The logic for these events is that they signal the changes to the previous state of this listener.
ADDED
vs CHANGED
: When you add the listener, every document is new to it, so it fires ADDED
events for each of them.
REMOVED
: when you add the listener after deleting a document, there is no knowledge of that document left in the database, so there's no information to fire such an event anymore.
It's important to realize that Firestore synchronizes state, not state changes. Which is for example why you don't get REMOVED
for those documents, but it also means you may miss state changes that cancel each other out.
If you want to synchronize state changes, you should store those changes in the database. For example, to ensure that your clients know of the document that was deleted, write a DELETED
status into the document rather than actually deleting it.
Post a Comment for "Firestore Does Not Notify Removed Change Type When Querying Documents"