firebase / flutterfire

🔥 A collection of Firebase plugins for Flutter apps.
https://firebase.google.com/docs/flutter/setup
BSD 3-Clause "New" or "Revised" License
8.64k stars 3.96k forks source link

Troubleshoot Firestore deletion behavior and add more tests #941

Closed kroikie closed 4 years ago

kroikie commented 4 years ago

@pulyaevskiy had some additional plans for the Firestore plugin on flutter/plugins#258

I've been trying to nail down this weird behavior with deleting items and it seems to be that this is an issue with underlying platform SDKs... but I'm not sure.

In short: deleting a document (while subscribed to a Query matching this document) results in following sequence of snapshot events with DocumentChanges:

  1. DocumentChangeType.removed with hasPendingWrites: false and isFromCache: false - OK
  2. DocumentChangeType.added with hasPendingWrites: false and isFromCache: true - ???
  3. DocumentChangeType.removed with hasPendingWrites: false and isFromCache: false - ???

Tested with AnimatedList and Dismissible items: deleted item appears in the list for a second and disappears again.

Wondering if anyone knows what am I doing wrong here?

I will be pushing some more changes this week in regards to SnapshotMetadata and adding some more tests.

kroikie commented 4 years ago

@collinjackson

The issue at https://github.com/flutter/flutter/issues/13028 has been closed and moved here. Future collaboration on this issue will be done here.

BondarenkoStas commented 4 years ago

https://github.com/flutter/flutter/issues/13028#issuecomment-544594576