-
Notifications
You must be signed in to change notification settings - Fork 904
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Firestore not working offline as expected | setDoc not updating local cache when offline #8696
Comments
I couldn't figure out how to label this issue, so I've labeled it for a human to triage. Hang tight. |
Just incase it helps, this is how I setup auth for firebase
|
Thanks for reporting @vishwa795. If you intend to work offline, you should probably not Also, I'm curious whether you see the same issue if you use |
This would just help me resolve the updateDocument function immediately. That will make it seem like the operation has been completed. But the primary issue I am facing is that, I'm not receiving onSnapshot callbacks when I make setDoc calls offline! |
Just tried out with |
Thanks for the update, @vishwa795 . I'll try to reproduce it. |
@vishwa795 I'm not able to reproduce the issue. I see the snapshot listener does indeed get new snapshots when I make updates to a document offline. |
Hey @vishwa795. We need more information to resolve this issue but there hasn't been an update in 5 weekdays. I'm marking the issue as stale and if there are no new updates in the next 5 days I will close it automatically. If you have more information that will help us get to the bottom of this, just add a comment! |
Operating System
macOS Sonoma (14.4.1)
Environment (if applicable)
Chrome 131.0.6778.205
Firebase SDK Version
11.0.2
Firebase SDK Product(s)
Firestore
Project Tooling
React app with Webpack
Detailed Problem Description
What I am trying to achieve?
Ability to add documents / update documents while the device is offline.
What actually happened?
Functions like
setDoc
do not resolve indefinitely until internet is available, which seems like the expected behaviour.However it's mentioned in docs that when persistance is enabled, firestore will update it's local cache first and trigger a onSnapshot callback (with
fromCache
andhasPendingWrites
true given thatincludeMetadataChanges
is marked true), which doesn't seem to be happening.Error / Unexpected behaviour
Firestore not updating local cache and not triggering onSnapshot when multi-tab persistance is enabled.
Relevant log snippets or console output
Pasting the debug logs from firestore that I see on browser console, when i go offline, and perform a
setDoc
operation.The above set of logs repeat multiple times in my browser console.
Steps and code to reproduce issue
Firestore Setup
onSnapshot setup
Update Document
In my case, document being updated in
updateDocument
is always guaranteed to be part of the result set of the query being passed into the onSnapshot.The text was updated successfully, but these errors were encountered: