Firebase & Firestore
Events for local changes metadata.hasPendingWrites
新增一個 doc 之後,會先出發 listener 才會送到後端,這個 metadata 可以判斷是不是這樣的情況 (local change)
https://firebase.google.com/docs/firestore/query-data/listen#events-local-changes
Add data to Cloud Firestore
https://firebase.google.com/docs/firestore/manage-data/add-data
Detach a listener
https://firebase.google.com/docs/firestore/query-data/listen#detach_a_listener
Firebase stop listening onAuthStateChanged
https://stackoverflow.com/questions/37370224/firebase-stop-listening-onauthstatechanged