[cloud_firestore]: Get from server immediately after a document is updated gives old cached data when snapshot is open #17352
Labels
blocked: firebase-sdk
platform: android
Issues / PRs which are specifically for Android.
platform: ios
Issues / PRs which are specifically for iOS.
plugin: cloud_firestore
type: bug
Something isn't working
Is there an existing issue for this?
Which plugins are affected?
Core
Which platforms are affected?
iOS, Android
Description
The short version is that when a snapshot listener for a document is already open and the app calls
get(GetOptions(source: Source.server))
for that document, instead of fetching fresh data from the server cloud_firestore is returning the most recently fetched snapshot data. Moreover theisFromCache
andhasPendingWrites
metadata values are both false. This means we do not have a way to fetch fresh data from firestore when we know that there has been updated.I believe this is a variant of this issue: #10153. The difference being that our write is done by the backend. We have verified that the backend waits for the transaction to complete and that the mobile app waits for the backend to respond before calling get().
The linked issue has been closed as 'will not fix' using this comment as justification however this seems incorrect for the following reasons:
Source.server
inGetOptions
makes no reference to this behaviour.Reproducing the issue
Same as #10153
In our case the transaction is run from a backend system but the outcome is the same.
Tested on both iOS and Android.
Firebase Core version
3.13.0
Flutter Version
3.29.3
Relevant Log Output
Flutter dependencies
Expand
Flutter dependencies
snippetAdditional context and comments
No response
The text was updated successfully, but these errors were encountered: