File tree Expand file tree Collapse file tree 2 files changed +23
-1
lines changed Expand file tree Collapse file tree 2 files changed +23
-1
lines changed Original file line number Diff line number Diff line change @@ -406,11 +406,14 @@ export function setLogLevel(level: PublicLogLevel): void {
406
406
export class Transaction
407
407
extends Compat < ExpTransaction >
408
408
implements PublicTransaction {
409
+ private _userDataWriter : UserDataWriter ;
410
+
409
411
constructor (
410
412
private readonly _firestore : Firestore ,
411
413
delegate : ExpTransaction
412
414
) {
413
415
super ( delegate ) ;
416
+ this . _userDataWriter = new UserDataWriter ( _firestore ) ;
414
417
}
415
418
416
419
get < T > (
@@ -419,7 +422,20 @@ export class Transaction
419
422
const ref = castReference ( documentRef ) ;
420
423
return this . _delegate
421
424
. get ( ref )
422
- . then ( result => new DocumentSnapshot ( this . _firestore , result ) ) ;
425
+ . then (
426
+ result =>
427
+ new DocumentSnapshot (
428
+ this . _firestore ,
429
+ new ExpDocumentSnapshot < T > (
430
+ this . _firestore . _delegate ,
431
+ this . _userDataWriter ,
432
+ result . _key ,
433
+ result . _document ,
434
+ result . metadata ,
435
+ ref . _converter
436
+ )
437
+ )
438
+ ) ;
423
439
}
424
440
425
441
set < T > (
Original file line number Diff line number Diff line change @@ -42,6 +42,12 @@ apiDescribe('Firestore', (persistence: boolean) => {
42
42
let docSnapshot = await doc . get ( ) ;
43
43
expect ( docSnapshot . data ( ) ) . to . deep . equal ( data ) ;
44
44
45
+ // Validate that the transaction API returns the same types
46
+ await db . runTransaction ( async transaction => {
47
+ let docSnapshot = await transaction . get ( doc ) ;
48
+ expect ( docSnapshot . data ( ) ) . to . deep . equal ( data ) ;
49
+ } ) ;
50
+
45
51
if ( validateSnapshots ) {
46
52
let querySnapshot = await collection . get ( ) ;
47
53
docSnapshot = querySnapshot . docs [ 0 ] ;
You can’t perform that action at this time.
0 commit comments