redux-firestore
redux-firestore copied to clipboard
"type: once" for Firestore
According to Firestore documentation, https://firebase.google.com/docs/firestore/pricing#listens,
when you use onSnapshot
, you are charged every time any document in the result set is changed or removed from a result set due to some change.
When using firestoreConnect
, there is no way to make sure the data only fetched once, just as we can do with firebaseConnect
. It means when you don't need realtime updates, you have to either write a custom data loader instead of using firestoreConnect
, or be charged for a lot of unnecessary read operations.
It would be great to have an ability to fetch data once when using firestoreConnect
. Maybe something along those lines { storeAs: "foo", once: true }
, or something like that.
Noted as a possible feature, thanks for posting! It may end up being something with get
since that is the syntax Firestore uses.
For now, folks can use get
in componentDidMount
Would love to see this feature as well!