File tree 1 file changed +12
-9
lines changed
packages/firestore/src/local
1 file changed +12
-9
lines changed Original file line number Diff line number Diff line change @@ -257,7 +257,7 @@ export class SimpleDb {
257
257
258
258
async runTransaction < T > (
259
259
mode : SimpleDbTransactionMode ,
260
- objectStores : string [ ] ,
260
+ objectStores : string [ ] , x
261
261
transactionFn : ( transaction : SimpleDbTransaction ) => PersistencePromise < T >
262
262
) : Promise < T > {
263
263
const readonly = mode . startsWith ( 'readonly' ) ;
@@ -273,15 +273,18 @@ export class SimpleDb {
273
273
objectStores
274
274
) ;
275
275
try {
276
- // TODO(schmidt-sebastian): Remove this code/comment or find a way to
277
- // make this a test-only setting.
278
- // // Horrible hack to verify that idempotent functions can be run more
279
- // // than once.
280
- // const transactionFnResult = (idempotent && attemptNumber === 1
281
- // ? transactionFn(transaction)
282
- // : PersistencePromise.resolve({} as T)
283
- // ).next(() => transactionFn(transaction))
284
276
const transactionFnResult = transactionFn ( transaction )
277
+ // TODO(schmidt-sebastian): Remove this code/comment or find a way to
278
+ // make this a test-only setting.
279
+ // Horrible hack to verify that idempotent functions can be run more
280
+ // than once.
281
+ . next ( result => {
282
+ if ( idempotent && attemptNumber == 1 ) {
283
+ class DOMException { }
284
+ throw new DOMException ( ) ;
285
+ }
286
+ return result ;
287
+ } )
285
288
. catch ( error => {
286
289
// Abort the transaction if there was an error.
287
290
transaction . abort ( error ) ;
You can’t perform that action at this time.
0 commit comments