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

132
Views
Firestore realtime updates missed while disconnected

I have a simple web app that uses Firestore to receive realtime updates. For simplicity, I can demonstrate the issue with the example from the documentation:

const unsub = onSnapshot(doc(db, "cities", "SF"), (doc) => {
  console.log("Current data: ", doc.data());
});

I am NOT using offline persistence and am using v 9.6.8.

Under normal conditions, everything works as expected. When I lose connectivity, however, I am not notified of changes that happen while disconnected even after connectivity is restored (I simulate this by going on 'airplane mode').

One option I've considered, but not yet tried, is to subscribe to connectivity events from the device (online and offline windows events). Before pursuing this option, I was wondering if there is a simpler or better solution.

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

0

Firestore synchronizes the state of the documents, and not necessarily all the changes in that state.

So if multiple changes happened to the SF document while you were offline, and some of the later changes erased changes that came earlier, you will not see those earlier changes. You will only see the correct current state when the connection is reestablished.

If you want to see all state changes, consider storing those actual state changes in the database (e.g. in an updates subcollection), so that none of them are overwritten by later changes to the same data.

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!