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>() {
@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;
}