mesqueeb / vuex-easy-firestore

Easy coupling of firestore and a vuex module. 2-way sync with 0 boilerplate!
https://mesqueeb.github.io/vuex-easy-firestore
MIT License
234 stars 28 forks source link

On snapshot fix #283

Closed louisameline closed 4 years ago

louisameline commented 4 years ago

Fixes #172 and #258

louisameline commented 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.

louisameline commented 4 years ago

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.

louisameline commented 4 years ago

I have another version coming, hold on.