This repository was archived by the owner on Mar 4, 2026. It is now read-only.
File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -509,7 +509,7 @@ export class Transaction implements firestore.Transaction {
509509 * @internal
510510 */
511511 async rollback ( ) : Promise < void > {
512- if ( ! this . _transactionId ) {
512+ if ( ! this . _transactionId || this . _readOnly ) {
513513 return ;
514514 }
515515
@@ -605,7 +605,7 @@ export class Transaction implements firestore.Transaction {
605605 ) ;
606606 }
607607 const result = await promise ;
608- if ( ! this . _readTime ) {
608+ if ( ! this . _readOnly ) {
609609 await this . commit ( ) ;
610610 }
611611 return result ;
Original file line number Diff line number Diff line change @@ -780,8 +780,7 @@ describe('transaction operations', () => {
780780 async ( transaction , docRef ) => {
781781 transaction . set ( docRef , { foo : 'bar' } ) ;
782782 } ,
783- begin ( { readOnly : { } } ) ,
784- rollback ( )
783+ begin ( { readOnly : { } } )
785784 )
786785 ) . to . eventually . be . rejectedWith (
787786 'Firestore read-only transactions cannot execute writes.'
@@ -824,8 +823,7 @@ describe('transaction operations', () => {
824823 { readOnly : true } ,
825824 ( transaction , docRef ) => transaction . get ( docRef ) ,
826825 begin ( { readOnly : { } } ) ,
827- getDocument ( ) ,
828- commit ( )
826+ getDocument ( )
829827 ) ;
830828 } ) ;
831829
You can’t perform that action at this time.
0 commit comments