samedhi / firemore

Firebase + Clojure -> Firemore
https://firemore.org/
MIT License
19 stars 4 forks source link

Handle metadata changes #49

Closed samedhi closed 4 years ago

samedhi commented 4 years ago

#js {:includeMetadataChanges true}

https://firebase.google.com/docs/firestore/query-data/listen

Currently you do not receive metadata updates. I think this is fine for now but might be a feature needed at some point in the future.

samedhi commented 4 years ago

Remember that on write Firestore always first returns a {hasPendingWrite: true}. Default behavior is to not create events for metadata only changes. So the notification you are first receiving is the "local" write change, you received a second notification when it was actually written to the server, but firebases default behavior is to not surface that second notification as it is a metadata only change.

samedhi commented 4 years ago

TODO: Default behavior should be to stay within the behavior of firestore. I think all write things should accept a third optional argument that is a map of options. One key in this made would be :include-metadata-changes. Pretty simple.

TODO: You can see whether a document is persisted or not by looking at its clojure meta and change :has-pending-write

samedhi commented 4 years ago

TODO: Make it more clear where the metadata for each object is actually being written in the firestore.cljs ns. Currently it is kind of all over.