[firestore][android] update transaction handler to reset command buffer at the start of each cycle

This commit is contained in:
Salakar 2018-02-23 09:51:05 +00:00
parent f5836d0325
commit 80e9e99789
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>() {
@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

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
*/
void setFirestoreTransaction(Transaction firestoreTransaction) {
void resetState(Transaction firestoreTransaction) {
this.commandBuffer = null;
this.firestoreTransaction = firestoreTransaction;
}