Skip to content

Commit 680849e

Browse files
authored
Fix: get the app when fetching named firestore (#1562)
* get the app when fetching named firestore * add changelog
1 parent 77c16ff commit 680849e

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
- Fix App fetching for named firestore instances (#1562).

src/common/providers/firestore.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ function _getValueProto(data: any, resource: string, valueFieldName: string) {
5454
/** @internal */
5555
export function createSnapshotFromProtobuf(data: Uint8Array, path: string, databaseId: string) {
5656
if (!firestoreInstance) {
57-
firestoreInstance = firestore.getFirestore(databaseId);
57+
firestoreInstance = firestore.getFirestore(getApp(), databaseId);
5858
}
5959
try {
6060
const dataBuffer = Buffer.from(data);
@@ -74,7 +74,7 @@ export function createBeforeSnapshotFromProtobuf(
7474
databaseId: string
7575
) {
7676
if (!firestoreInstance) {
77-
firestoreInstance = firestore.getFirestore(databaseId);
77+
firestoreInstance = firestore.getFirestore(getApp(), databaseId);
7878
}
7979
try {
8080
const dataBuffer = Buffer.from(data);
@@ -97,7 +97,7 @@ export function createSnapshotFromJson(
9797
) {
9898
if (!firestoreInstance) {
9999
firestoreInstance = databaseId
100-
? firestore.getFirestore(databaseId)
100+
? firestore.getFirestore(getApp(), databaseId)
101101
: firestore.getFirestore(getApp());
102102
}
103103
const valueProto = _getValueProto(data, source, "value");
@@ -122,7 +122,7 @@ export function createBeforeSnapshotFromJson(
122122
) {
123123
if (!firestoreInstance) {
124124
firestoreInstance = databaseId
125-
? firestore.getFirestore(databaseId)
125+
? firestore.getFirestore(getApp(), databaseId)
126126
: firestore.getFirestore(getApp());
127127
}
128128

0 commit comments

Comments
 (0)