Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

157
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda