-
Notifications
You must be signed in to change notification settings - Fork 580
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] whereArrayContains not working in offline scenario. #155
Comments
Hrm. That certainly doesn't sound expected. I'll try to reproduce. |
@IvanBean Thanks for reporting this! I've reproduced the issue and tracked it down to a bug in our local query processing here. It will happen when you do an update() that causes a document that used to not-match the query to now match the query. Basically, since the original document didn't match the query, we fail to apply the update(), and so it doesn't get considered in the final query results. :-/ As a workaround you could potentially use a We'll take a look at getting this fixed in an upcoming release. Thanks again for reporting it. |
@var-const I wonder if this is something you might be able to look at tackling? I went to try to fix it on web (so I could write a spec test for validation), but realized I wanted the Here's the spec test I wrote (with the intention of adding it to listen_spec.test.ts after the "Ensure correct query results with latency-compensated deletes" test:
NOTE: I verified it fails in the way I expect, but since I haven't fixed the bug can't 100% guarantee it's correct. :-) Alternatively, I can look at tackling this once you've ported your perf improvements to web. Thanks. |
Michael, I think I can do it together with the porting. |
…tion. (#1957) When a local patch mutation is not acked by server yet, but the mutation makes a document matching a query, the document might not show up in the compensated query results. This PR fixes the bug. See firebase/firebase-android-sdk#155
[REQUIRED] Step 2: Describe your environment
[REQUIRED] Step 3: Describe the problem
Add a string value to document's array by
arrayUnion
when the device is offline, the snapshot listener shows it added successfully but later we query bywhereArrayContains
shows empty result.Steps to reproduce:
Let's say we have a collection
todos
containing a single documenttodo1
, which had only one fieldtaskIds
as a string array. The schema: https://i.imgur.com/CmAFWgx.pngStep to reproduce:
In the beging the log shows:
todos {taskIds=[]}
Turn device to offline, kill and re-launch the app.
Create a task document with auto-generate id, add the id to document "todo1" by
arrayUnion
:The listener at step 1 now shows log:
todos {taskIds=[mMifGffC5WEMjALjR6xR]}
, so the taskId is added successfully.whereArrayContains
, either byget()
:or
addSnapshotListener
:The result are the same:
But I expect the result size be 1 because document "todo1" should be included.
The same steps work well when device online, both query shows size 1 with
addSnapshotListener
is from cache andget()
isn't.Any reply were be appreciated, thanks.
The text was updated successfully, but these errors were encountered: