Skip to content
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

Support for cloud_firestore 4.4.0 #266

Merged
merged 3 commits into from Feb 18, 2023
Merged

Conversation

sydneyagcaoili
Copy link
Contributor

@sydneyagcaoili sydneyagcaoili commented Feb 15, 2023

What's in this PR

Problem

  • With the latest cloud_firestore changes, when using this version, signature related errors appeared.
  • With this change, we need to support FieldPath on docRef.update

Fix

  • convert relevant signatures to match cloud_firestore 's
  • Add support for FieldPath params to docRef.update
  • Fix test related issues
  • Add test for FieldPath support on docRef.update

@sydneyagcaoili
Copy link
Contributor Author

#265 relevant issue

@atn832
Copy link
Owner

atn832 commented Feb 16, 2023

This looks very good. And thanks for the quick fix.

@@ -103,7 +103,7 @@ class MockDocumentReference<T extends Object?> implements DocumentReference<T> {
message: 'Some requested document was not found.',
));
}
return _setRawData(data);
return _setRawData(Map.from(data));
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is this for?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Due to new support to FieldPath on update, the Map<String, dynamic> is not gonna cut it.. Seems this needs more work.

@atn832
Copy link
Owner

atn832 commented Feb 16, 2023

Looks like all unit tests still pass. Awesome!

One more thing you could do in this PR is modify the affected pre-existing unit tests by passing iterables. In the Firestore PR you mentioned, they used this trick in their tests:

// To force the list to be an iterable
whereIn: ['Ready to Ship', 'Ordered'].map((e) => e),

We could make a utility function and use it here and there:

Iterable<R> toIterable<R>(List<R> list) => list.map((e) => e);

The tests in question should be in:

@sydneyagcaoili
Copy link
Contributor Author

@atn832 Agreed on supporting iterables.

Seems there needs to be more work on supporting FieldPath on update. Not confident I'll be able to work on it quickly due to main commitments. But can do in my free time when no one else does.

@sydneyagcaoili sydneyagcaoili marked this pull request as ready for review February 16, 2023 17:40
@atn832 atn832 merged commit e8db692 into atn832:master Feb 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants