Closed louisameline closed 4 years ago
You'll see that I rewrote the function with more if/else. I know you're not a fan but it was getting too complex to do without those. I also commented a lot. We can argue the pros and cons at some point ;)
You'll see what I did with metadata to ignore the local calls, check out Firestore's documentation here: https://firebase.google.com/docs/firestore/query-data/listen
Beyond the fix and restructuring, there is a minor improvement as I took into account the success of the initial document insert to fullfill the promise or not, which was previously ignored.
Also, initial data is no longer retrieved from Firestore's cache. It shouldn't break anything, but apps may take a few more milliseconds to load. I'll think about this some more.
I have another version coming, hold on.
Fixes #172 and #258