[firestore][android] update transaction handler to reset command buffer at the start of each cycle
This commit is contained in:
parent
f5836d0325
commit
80e9e99789
|
@ -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
|
||||||
|
|
|
@ -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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue