-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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: setting includeMetadataChanges = true
does not result in receiving isFromCache = false
after first run.
#12869
Comments
Hi @TarekkMA, thank you for reporting this issue. |
@milaGGL It works as expected when listening to a query the first time, but if you recreate the query or restart the app on the same exact data, it will not work as expected; it will return the cached data and never isFromCache == false until the data is updated again or the app storage cleared. This issue only happened after I updated to the latest version. |
I have tested the below:
Test 2:
Both of them are working as expected in the SDK tests. Could you please provide a repro app? |
I am testing it on firebase-ios-sdk v10.25.0 with iOS simulator. |
@milaGGL I have never ran my projects on the iOS simulator therefore this might be the issue. As for the SDK version you are using, I do not know which iOS SDK version cloud_firestore (4.17.2) internally uses so this might be another cause why the error is not reproducing on your side. Can you please try it on an iOS device with a Flutter project with cloud_firestore (4.17.2)? |
The most recent change to snapshot listener is introduced in ios sdk v10.23.0, which maps to cloud_firestore 4.17.0. Could you please provide a repro app on native iOS, not flutter, to narrow down the bug into the firebase-ios-sdk? |
@milaGGL Sorry for the late reply, here's a reproduction repo. https://github.com/TarekkMA/firebase-ios-reproduction/tree/ff/12722. You can see I get only one log statment with:
cc: @ramsayamarin |
@TarekkMA, i am trying to reproduce the error on xcode. Meanwhile, could you please update the |
I tried the test1( creating a second snapshot listener) with the debug app, and it is working as expected. Could you please add one more button to remove the snapshot listener, so that we can try the test2, re-create a listener? I tried to add the button, but iOS app is not my strong suit. |
@milaGGL, thank you! It was an issue on our part. The problem was that we were not using optionsWithSourceAndMetadata; instead, we used options. Now I'm getting 2 results, which solves our issue:
|
Nice! 🎉 Closing the ticket as the problem is solved. |
Description
When querying documents using the options:
source
set toFIRListenSourceDefault
includeMetadataChanges
set totrue
\The expected behavior is to receive two results. The first result should have
isFromCache
marked asYES
, and the second should haveisFromCache
marked asNO
. However, the actual behavior observed is that only one result is returned withisFromCache
marked asNO
.Reference:
Reproducing the issue
source
asFIRListenSourceDefault
.includeMetadataChanges
.Firebase SDK Version
10.24.0
Xcode Version
15.3
Installation Method
CocoaPods
Firebase Product(s)
Firestore
Targeted Platforms
iOS
Relevant Log Output
No response
If using Swift Package Manager, the project's Package.resolved
Expand
Package.resolved
snippetReplace this line with the contents of your Package.resolved.
If using CocoaPods, the project's Podfile.lock
Expand
Podfile.lock
snippetReplace this line with the contents of your Podfile.lock!
The text was updated successfully, but these errors were encountered: