diff --git a/android/src/main/java/io/invertase/firebase/firestore/RNFirebaseFirestore.java b/android/src/main/java/io/invertase/firebase/firestore/RNFirebaseFirestore.java index 3bb250f5..48191f53 100644 --- a/android/src/main/java/io/invertase/firebase/firestore/RNFirebaseFirestore.java +++ b/android/src/main/java/io/invertase/firebase/firestore/RNFirebaseFirestore.java @@ -263,7 +263,7 @@ public class RNFirebaseFirestore extends ReactContextBaseJavaModule { .runTransaction(new Transaction.Function() { @Override 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 // otherwise it gets blocked by the pending lock await diff --git a/android/src/main/java/io/invertase/firebase/firestore/RNFirebaseFirestoreTransactionHandler.java b/android/src/main/java/io/invertase/firebase/firestore/RNFirebaseFirestoreTransactionHandler.java index cf84ca64..ef136ed7 100644 --- a/android/src/main/java/io/invertase/firebase/firestore/RNFirebaseFirestoreTransactionHandler.java +++ b/android/src/main/java/io/invertase/firebase/firestore/RNFirebaseFirestoreTransactionHandler.java @@ -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 */ - void setFirestoreTransaction(Transaction firestoreTransaction) { + void resetState(Transaction firestoreTransaction) { + this.commandBuffer = null; this.firestoreTransaction = firestoreTransaction; }