File tree Expand file tree Collapse file tree 1 file changed +13
-0
lines changed
packages/firestore/src/local Expand file tree Collapse file tree 1 file changed +13
-0
lines changed Original file line number Diff line number Diff line change @@ -121,6 +121,15 @@ export class SimpleDbTransaction {
121121 }
122122 }
123123
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+
124133 /**
125134 * Returns a SimpleDbStore<KeyType, ValueType> for the specified store. All
126135 * operations performed on the SimpleDbStore happen within the context of this
@@ -400,6 +409,10 @@ export class SimpleDb {
400409 objectStores
401410 ) ;
402411 const transactionFnResult = transactionFn ( transaction )
412+ . next ( result => {
413+ transaction . maybeCommit ( ) ;
414+ return result ;
415+ } )
403416 . catch ( error => {
404417 // Abort the transaction if there was an error.
405418 transaction . abort ( error ) ;
You can’t perform that action at this time.
0 commit comments