-
Notifications
You must be signed in to change notification settings - Fork 939
Treat empty maps correctly in Document.get() #2206
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
Conversation
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.
Can we not add a test for this?
Also, I don't exactly understand the issue. proto.fields
can be missing if the document is empty? Is there a similar issue with empty maps inside a document? Or is only the root of the document an issue for some reason? If you can find a way to add comments to make it clearer, that might be nice. :-)
I fixed the browser tests and was now able to write a test that fails on master and succeeds with this PR. I did not add any inline comments as the types should speak for themselves. As for your questions - I don't think
|
I fixed the browser tests and was now able to write a test that fails on master and succeeds with this PR. I did not add any inline comments as the types should speak for themselves. As for your questions - I don't think
|
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.
LGTM
Fixes #2204
This fixes the types for MapValue.fields so that tslint catches undefined violations and removes the violation in
getProtoField
that caused #2204Note that is seems pretty involved to write a test for this since this code is only hit in Query processing and not in DocumentSnapshot.get() (see
firebase-js-sdk/packages/firestore/src/api/database.ts
Line 1346 in 4016987