Skip to content

Commit 7ec7a0c

Browse files
committed
DocumentSet fix.
1 parent 90ade11 commit 7ec7a0c

File tree

1 file changed

+6
-12
lines changed

1 file changed

+6
-12
lines changed

packages/firestore/src/api/snapshot.ts

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -925,22 +925,16 @@ export class QuerySnapshot<
925925

926926
// Construct the arrays of document data for the query.
927927
const bundledDocuments = bundleLoader.documents;
928-
const documentSet = new DocumentSet();
929-
const documentKeys = documentKeySet();
930-
for (const bundledDocumet of bundledDocuments) {
931-
const document = fromDocument(serializer, bundledDocumet.document!);
932-
documentSet.add(document);
933-
const documentPath = ResourcePath.fromString(
934-
bundledDocumet.metadata.name!
935-
);
936-
documentKeys.add(new DocumentKey(documentPath));
937-
}
938-
928+
let documentSet = new DocumentSet();
929+
bundledDocuments.map(bundledDocument => {
930+
const document = fromDocument(serializer, bundledDocument.document!);
931+
documentSet = documentSet.add(document);
932+
});
939933
// Create a view snapshot of the query and documents.
940934
const viewSnapshot = ViewSnapshot.fromInitialDocuments(
941935
query,
942936
documentSet,
943-
documentKeys,
937+
documentKeySet() /* Zero mutated keys signifies no pending writes. */,
944938
/* fromCache= */ false,
945939
/* hasCachedResults= */ false
946940
);

0 commit comments

Comments
 (0)