Learn how to migrate from legacy live query APIs to store observers with the new Differ
event
parameter that contains a diff of the current live query event against the previous one—a summary of which documents in the result have been:
Differ
class to compute one when needed.
event
parameterevent.oldDocuments
for deleted items (uses memory)event.isInitial
flag for the first callbackDiffer
classdiff.deletions
or diff.moves
to access deleted and moved documents from your stored previousItems
.
event.isInitial
flag isn’t available with the Differ. To detect the first callback:
differ.diff
show up as insertions because the differ is initially empty.
Differ
ignores metadata changes when determining updates. For example: