-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Description
[REQUIRED] Step 2: Describe your environment
- Xcode version: 9.4 (9F1027a)
- Firebase SDK version: 5.4.1
- Firebase Component: Firestore
- Component version: 0.12.6
[REQUIRED] Step 3: Describe the problem
Steps to reproduce:
-
Set up a query on any subcollection with a limit smaller than the number of elements in the subcollection already, for example, 5.
-
Delete one of the first documents returned by the query.
-
Observe that the query listener initially receives a snapshot without the deleted document, e.g. 4 documents in it for the query limited to last 5. Then it gets a cached snapshot with the original documents, so just deleted document appears as added back. Then comes a 3rd snapshot without the deleted document and with additional document in the end of the list pulled from the server.
-
In case the result of the query is directly monitored by UI, then the UI flickers: the item is removed first, comes back again, and then is removed again.
-
Note that our initial workaround where we ignored the cached snapshot in case we had some data already does not work in all the cases.
Logs from the example app:
2018-07-25 16:30:45.613118+0200 FirestoreSyncIssue[58674:20831755] Deleting the document for 'Stroopwafel #9'
2018-07-25 16:30:45.623390+0200 FirestoreSyncIssue[58674:20831755] Top 5 collection snapshot changed: 4 document(s) (from cache: 0)
2018-07-25 16:30:45.623700+0200 FirestoreSyncIssue[58674:20831755] Items: (
"Coconut macaroon #10",
"Oreo #7",
"Charcoal biscuit #10",
"Cream cracker #9"
)
2018-07-25 16:30:45.978800+0200 FirestoreSyncIssue[58674:20831755] Deleted 'Stroopwafel #9'
2018-07-25 16:30:46.343615+0200 FirestoreSyncIssue[58674:20831755] Top 5 collection snapshot changed: 5 document(s) (from cache: 1)
2018-07-25 16:30:46.343926+0200 FirestoreSyncIssue[58674:20831755] Items: (
"Coconut macaroon #10",
"Stroopwafel #9",
"Oreo #7",
"Charcoal biscuit #10",
"Cream cracker #9"
)
2018-07-25 16:30:46.474503+0200 FirestoreSyncIssue[58674:20831755] Top 5 collection snapshot changed: 5 document(s) (from cache: 0)
2018-07-25 16:30:46.474843+0200 FirestoreSyncIssue[58674:20831755] Items: (
"Coconut macaroon #10",
"Oreo #7",
"Charcoal biscuit #10",
"Cream cracker #9",
"Charcoal biscuit #8"
)
Relevant Code:
See the example app and another video.