Skip to content
This repository was archived by the owner on Apr 4, 2023. It is now read-only.

Commit 9d7377c

Browse files
Using a Dynamic value for a document / collection makes the application crash #854
1 parent d821a51 commit 9d7377c

File tree

3 files changed

+17
-2
lines changed

3 files changed

+17
-2
lines changed

demo-ng/app/tabs/firestore/firestore.component.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
<Button text="login anonymously" (tap)="loginAnonymously()" class="button button-user"></Button>
44
<Label text="After pressing these buttons, check the console log" textWrap="true"></Label>
55

6+
<Button text="Issue 854" (tap)="issue854()" class="button"></Button>
67
<Button text="Add" (tap)="firestoreAdd()" class="button"></Button>
78
<Button text="Set" (tap)="firestoreSet()" class="button"></Button>
89
<Button text="Set (auto id)" (tap)="firestoreSetByAutoID()" class="button"></Button>

demo-ng/app/tabs/firestore/firestore.component.ts

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,23 @@ export class FirestoreComponent {
2626
// AngularFireModule.initializeApp({});
2727
}
2828

29+
public issue854(): void {
30+
const helloRef: firestore.DocumentReference =
31+
firebase.firestore()
32+
.collection("users")
33+
.doc(firebase.auth().currentUser.uid)
34+
.collection("availability")
35+
.doc("hello");
36+
37+
helloRef.get().then(snapshot => console.log(snapshot.data()))
38+
}
39+
2940
public loginAnonymously(): void {
3041
firebase.auth().signInAnonymously()
31-
.then(() => console.log("Logged in"))
42+
.then(() => {
43+
const user = firebase.auth().currentUser;
44+
firebase.firestore().collection("users").doc(user.uid).set(user);
45+
})
3246
.catch(err => console.log("Login error: " + JSON.stringify(err)));
3347
}
3448

demo-ng/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,4 +43,4 @@
4343
"nativescript-dev-webpack": "^0.15.1",
4444
"typescript": "~2.7.2"
4545
}
46-
}
46+
}

0 commit comments

Comments
 (0)