Merge remote-tracking branch 'origin/firestore-transactions' into firestore-transactions

This commit is contained in:
Salakar 2018-02-24 08:57:30 +00:00
commit c792cd9146
2 changed files with 4 additions and 3 deletions

View File

@ -263,7 +263,7 @@ public class RNFirebaseFirestore extends ReactContextBaseJavaModule {
.runTransaction(new Transaction.Function<Void>() { .runTransaction(new Transaction.Function<Void>() {
@Override @Override
public Void apply(@NonNull Transaction transaction) throws FirebaseFirestoreException { public Void apply(@NonNull Transaction transaction) throws FirebaseFirestoreException {
transactionHandler.setFirestoreTransaction(transaction); transactionHandler.resetState(transaction);
// emit the update cycle to JS land using an async task // emit the update cycle to JS land using an async task
// otherwise it gets blocked by the pending lock await // otherwise it gets blocked by the pending lock await

View File

@ -51,11 +51,12 @@ class RNFirebaseFirestoreTransactionHandler {
} }
/** /**
* Keep a ref to the Transaction instance. * Reset handler state - clears command buffer + updates to new Transaction instance
* *
* @param firestoreTransaction * @param firestoreTransaction
*/ */
void setFirestoreTransaction(Transaction firestoreTransaction) { void resetState(Transaction firestoreTransaction) {
this.commandBuffer = null;
this.firestoreTransaction = firestoreTransaction; this.firestoreTransaction = firestoreTransaction;
} }