Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit dba59c3

Browse files
authoredSep 14, 2020
Merge branch 'master' into mrschmidt/removeinterface
2 parents 281546e + b1854ab commit dba59c3

File tree

11 files changed

+203
-217
lines changed

11 files changed

+203
-217
lines changed
 

‎.changeset/tame-donuts-relate.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@firebase/firestore': patch
3+
---
4+
5+
Fixed a bug where CollectionReference.add() called FirestoreDataConverter.toFirestore() twice intead of once (#3742).

‎integration/messaging/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
"express": "4.17.1",
1616
"geckodriver": "1.20.0",
1717
"mocha": "7.2.0",
18-
"node-fetch": "2.6.0",
18+
"node-fetch": "2.6.1",
1919
"selenium-assistant": "6.1.0"
2020
}
2121
}

‎package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@
101101
"find-free-port": "2.0.0",
102102
"firebase-functions": "3.11.0",
103103
"firebase-tools": "8.9.2",
104-
"git-rev-sync": "2.0.0",
104+
"git-rev-sync": "3.0.1",
105105
"glob": "7.1.6",
106106
"http-server": "0.12.3",
107107
"husky": "4.2.5",

‎packages/firestore/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@
6767
"@firebase/webchannel-wrapper": "0.3.0",
6868
"@grpc/grpc-js": "^1.0.0",
6969
"@grpc/proto-loader": "^0.5.0",
70-
"node-fetch": "2.6.0",
70+
"node-fetch": "2.6.1",
7171
"tslib": "^1.11.1"
7272
},
7373
"peerDependencies": {

‎packages/firestore/src/api/database.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2379,8 +2379,17 @@ export class CollectionReference<T = DocumentData>
23792379
? this._converter.toFirestore(value)
23802380
: value;
23812381
validateArgType('CollectionReference.add', 'object', 1, convertedValue);
2382+
23822383
const docRef = this.doc();
2383-
return docRef.set(value).then(() => docRef);
2384+
2385+
// Call set() with the converted value directly to avoid calling toFirestore() a second time.
2386+
return new DocumentReference(
2387+
(docRef as DocumentReference<T>)._key,
2388+
this.firestore,
2389+
null
2390+
)
2391+
.set(convertedValue)
2392+
.then(() => docRef);
23842393
}
23852394

23862395
withConverter<U>(

‎packages/firestore/src/core/query.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -854,6 +854,11 @@ export class NotInFilter extends FieldFilter {
854854
}
855855

856856
matches(doc: Document): boolean {
857+
if (
858+
arrayValueContains(this.value.arrayValue!, { nullValue: 'NULL_VALUE' })
859+
) {
860+
return false;
861+
}
857862
const other = doc.field(this.field);
858863
return other !== null && !arrayValueContains(this.value.arrayValue!, other);
859864
}

0 commit comments

Comments
 (0)
Please sign in to comment.