File tree 1 file changed +13
-0
lines changed
packages/firestore/src/local 1 file changed +13
-0
lines changed Original file line number Diff line number Diff line change @@ -121,6 +121,15 @@ export class SimpleDbTransaction {
121
121
}
122
122
}
123
123
124
+ maybeCommit ( ) : void {
125
+ // If the browser supports V3 indexedDb, invoke commit() explicitly to
126
+ // speed up index DB processing if the event loop remains blocks.
127
+ const maybeV3IndexedDb = this . transaction as any ;
128
+ if ( typeof maybeV3IndexedDb . commit === 'function' ) {
129
+ maybeV3IndexedDb . commit ( ) ;
130
+ }
131
+ }
132
+
124
133
/**
125
134
* Returns a SimpleDbStore<KeyType, ValueType> for the specified store. All
126
135
* operations performed on the SimpleDbStore happen within the context of this
@@ -400,6 +409,10 @@ export class SimpleDb {
400
409
objectStores
401
410
) ;
402
411
const transactionFnResult = transactionFn ( transaction )
412
+ . next ( result => {
413
+ transaction . maybeCommit ( ) ;
414
+ return result ;
415
+ } )
403
416
. catch ( error => {
404
417
// Abort the transaction if there was an error.
405
418
transaction . abort ( error ) ;
You can’t perform that action at this time.
0 commit comments