-
Notifications
You must be signed in to change notification settings - Fork 874
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
Make FieldValue a Compat class #3819
Conversation
|
Binary Size ReportAffected SDKs
Test Logs
|
a5fb4d7
to
59687d3
Compare
} | ||
|
||
isEqual(other: FieldValue): boolean { | ||
return this._delegate === other._delegate; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could the implementation delegate to the isEqual
method of this._delegate
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, I was under the impression that we didn't have an isEqual
in the firestore-exp SDK. This is however part of the approved API, so let me see if I can add it here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed (also managed to remove SerializableFieldValue)
@@ -144,6 +147,13 @@ apiDescribe('Array Transforms:', (persistence: boolean) => { | |||
}); | |||
}); | |||
|
|||
it('arrayUnion() supports DocumentReference', async () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Was this just some missing test coverage?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was afraid that this PR would break this behavior, since I wasn't sure if the new FieldValue types could deal with the legacy API.
packages/firestore/exp/test/shim.ts
Outdated
constructor( | ||
private readonly _firestore: FirebaseFirestore, | ||
private readonly _delegate: exp.Transaction | ||
) {} | ||
private readonly delegate: exp.Transaction |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should the private
and readonly
modifiers on delegate
be dropped? This may be my TypeScript noobyness surfacing, but wouldn't this create two properties, delegate
and _delegate
, both of which store the same exp.Transaction
object?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
s/noobyness/expertyness/
Thanks for catching.
This is the first of many PRs for go/firebase-next-compat
The idea is that we will remove our legacy API types and instead replace them with shims that delegate all work to the new APIs from firestore-exp. We already use this "trick" in our tests: https://github.com/firebase/firebase-js-sdk/blob/master/packages/firestore/exp/test/shim.ts
This PR makes the FieldValue Shim in the test production ready: