Skip to content

Commit

Permalink
Add missing compat Firestore conversion for runTransaction (#5668)
Browse files Browse the repository at this point in the history
* Add missing compat Firestore conversion for runTransaction

* Lint

* Create spotty-bags-double.md
  • Loading branch information
wu-hui committed Oct 27, 2021
1 parent 1048c4f commit f485276
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .changeset/spotty-bags-double.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@firebase/firestore": patch
---

Add missing compat Firestore conversion for runTransaction
2 changes: 2 additions & 0 deletions packages/firestore/src/api/transaction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import { Transaction as InternalTransaction } from '../core/transaction';
import { DocumentReference } from '../lite-api/reference';
import { Transaction as LiteTransaction } from '../lite-api/transaction';
import { validateReference } from '../lite-api/write_batch';
import { cast } from '../util/input_validation';

import { ensureFirestoreConfigured, Firestore } from './database';
import { ExpUserDataWriter } from './reference_impl';
Expand Down Expand Up @@ -93,6 +94,7 @@ export function runTransaction<T>(
firestore: Firestore,
updateFunction: (transaction: Transaction) => Promise<T>
): Promise<T> {
firestore = cast(firestore, Firestore);
const client = ensureFirestoreConfigured(firestore);
return firestoreClientTransaction(client, internalTransaction =>
updateFunction(new Transaction(firestore, internalTransaction))
Expand Down

0 comments on commit f485276

Please sign in to comment.