atn832 / fake_cloud_firestore

BSD 2-Clause "Simplified" License
119 stars 93 forks source link

listeners not updating with #284 fix #294

Closed diegogarciar closed 4 months ago

diegogarciar commented 7 months ago

My app has a FirestoreClient that forces you to use converters, the converter transforms the response into an Either<FirestoreFailure,Data> and it works great, for our testing we simply instantiate FakeFirebaseFirestore and write to the collection directly without the use of converters because we don't need to provide an object so its easier for us to tests the scenarios when data might be missing.

With the introduction of #284, we can no longer test this because the fireSnapshotUpdate is checking for the converter type. so if you have a converter set but want to write directly without a converter, the listeners are not triggered. The issue comes because that change introduced the creation of a new copy of the querySnapshot that requires the code to know the type of .

I'm not entirely sure what's the purpose of this, but I would like to propose to add the previous behavior if the condition is not met for now so that we keep backwards compatibility.

image

https://github.com/atn832/fake_cloud_firestore/blob/dd3586df91af12b74f1ce7516e019baf33b853b4/lib/src/query_snapshot_stream_manager.dart#L102-L137