diff --git a/lib/modules/firestore/DocumentChange.js b/lib/modules/firestore/DocumentChange.js index c9c98b98..39697788 100644 --- a/lib/modules/firestore/DocumentChange.js +++ b/lib/modules/firestore/DocumentChange.js @@ -21,8 +21,8 @@ export default class DocumentChange { _oldIndex: number; _type: string; - constructor(nativeData: DocumentChangeNativeData) { - this._document = nativeData.document; + constructor(firestore: Object, nativeData: DocumentChangeNativeData) { + this._document = new DocumentSnapshot(firestore, nativeData.document); this._newIndex = nativeData.newIndex; this._oldIndex = nativeData.oldIndex; this._type = nativeData.type; diff --git a/lib/modules/firestore/QuerySnapshot.js b/lib/modules/firestore/QuerySnapshot.js index 26b910d6..a3ec9050 100644 --- a/lib/modules/firestore/QuerySnapshot.js +++ b/lib/modules/firestore/QuerySnapshot.js @@ -25,7 +25,7 @@ export default class QuerySnapshot { _query: Query; constructor(firestore: Object, query: Query, nativeData: QuerySnapshotNativeData) { - this._changes = nativeData.changes.map(change => new DocumentChange(change)); + this._changes = nativeData.changes.map(change => new DocumentChange(firestore, change)); this._docs = nativeData.documents.map(doc => new DocumentSnapshot(firestore, doc)); this._metadata = nativeData.metadata; this._query = query;