Skip to content

Does subscribing multiple times to the same collection or document trigger multiple reads? #2761

Answered by davideast
LanderBeeuwsaert asked this question in Q&A
Discussion options

You must be logged in to vote

It depends! In general the underlying Firestore SDK tries its best to use a cached result instead of going over the network. The protocol it uses also sends only the delta of the update. In your case if the records have not been modified since the previous subscription, there should be further reads. This is as long as the local cache is not cleared.

In general you can assume that the Firestore SDK's cache is going to keep you from re-reading a document if it has not be updated. This caching behavior applies to .onSnapshot() but not .get() calls.

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by davideast
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants