Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

154
Views
Firestore: are documents that are part of a onSnapshot query pre-loaded?

I want to make sure I'm understanding Firestore fetch semantics properly.

I have a query that gets a list of documents from Firestore, from a collection called "example"

onSnapshot(myQuery of example collection, snapshot => {
   // contains various documents
   // including documentId = 123abc
})

In a different part of my application, I set up onSnapshot for a single document (that was included in the results of the previous query):

onSnapshot(doc(db, "example", "123abc"), snapshot => [...])

So the document that I'm setting up a listener for already has a listener, as part of the overall query listener used in a different part of the app (but still running).

My question is: Does adding a snapshot to the individual document result in another read from Firestore, or does it automagically use the same document listener and not add another read? If so, does that hold for changes to the document?

Let me know if you need me to clarify the question at all. Thanks in advance!

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

The Firebase SDK deduplicates listeners behind the scenes, so adding an additional snapshot listener for a document that is already in memory will give you that snapshot from memory and will not reread the document from the server.

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!