Skip to content

Commit 75b105a

Browse files
Match DocumentReference
1 parent e63d8cd commit 75b105a

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

packages/firestore/src/api/database.ts

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -649,7 +649,7 @@ export class Firestore
649649

650650
batch(): PublicWriteBatch {
651651
this._ensureClientConfigured();
652-
return new WriteBatch(this, this._firestoreClient!);
652+
return new WriteBatch(this);
653653
}
654654

655655
// Visible for testing.
@@ -815,10 +815,7 @@ export class WriteBatch implements PublicWriteBatch {
815815
private _mutations = [] as Mutation[];
816816
private _committed = false;
817817

818-
constructor(
819-
private _firestore: Firestore,
820-
private _firestoreClient: FirestoreClient
821-
) {}
818+
constructor(private _firestore: Firestore) {}
822819

823820
set<T>(
824821
documentRef: DocumentReference<T>,
@@ -932,7 +929,8 @@ export class WriteBatch implements PublicWriteBatch {
932929
this.verifyNotCommitted();
933930
this._committed = true;
934931
if (this._mutations.length > 0) {
935-
return firestoreClientWrite(this._firestoreClient, this._mutations);
932+
const firestoreClient = this._firestore._ensureClientConfigured();
933+
return firestoreClientWrite(firestoreClient, this._mutations);
936934
}
937935

938936
return Promise.resolve();

0 commit comments

Comments
 (0)