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