How to know when a Firestore document is written to local database #8695
              
                Unanswered
              
          
                  
                    
                      llamington
                    
                  
                
                  asked this question in
                Q&A
              
            Replies: 0 comments
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment
  
        
    
Uh oh!
There was an error while loading. Please reload this page.
-
When the device is offline and I attempt to write a document to Firestore (e.g. with
addDoc), the promise associated with the call toaddDocis pending until the document gets written to the remote Firestore (i.e. when the device comes back online). Often when writing data I want to show the user a loading screen, then direct the user to a different screen once the loading has completed. The problem I have is when I write a document usingaddDocwhile the device is offline, I don't know when to direct the user to the "success" state since I have no idea when the document gets written to local storage. Is there some method for me to determine whether the write to local storage was successful?Thank you!
Beta Was this translation helpful? Give feedback.
All reactions