-
Notifications
You must be signed in to change notification settings - Fork 989
Closed
Description
Environment
- Operating System version: MacOS High Sierra, 10.13.4
- Firebase SDK version: 4.13.1
- Firebase Product: Firestore
- Angularfire2 5.0.0-rc.6.0
Problem
I have a working app and started switching from realtime database to firestore.
I'm trying the simplest operations, but 90% of the time I don't see my changes in the database, in the rest of the cases the data is properly created, without me changing anything in the codebase. I tried stack tracing with breakpoints, but even when data is not created in the DB, I can see that the new document's path and id is correctly set in local variables.
I see no console errors, so not sure how to debug this further. Tried reverting Firebase to 4.12.1, but same issue happens.
Steps to reproduce:
Relevant Code:
const userData = this.signupForm.value;
this.authProvider.auth
.createUserWithEmailAndPassword(userData.email, userData.password)
.then(response => {
delete userData.password;
const uid = response.uid;
this.authService.logout();
const museumData = {
name: userData.museumName,
isActive: false,
country: 'hu'
};
this.museumService.create(museumData)
.then(docRef => {
const museumKey = docRef.id;
userData.museumKey = museumKey;
userData.role = 'admin';
const userKey = this.userService.create(uid, userData)
.then(() => {
this.isSignupSuccessful = true;
});
this.museumService.addUser(museumKey, uid);
});
}) this.museumService.create(museumData) doesn't return its promise. You can see the related service method below.
constructor (
private db: AngularFirestore
) {
db.firestore.settings({ timestampsInSnapshots: true });
this.collection = db.collection<Museum>('museums');
}
create(data) {
return this.collection.add(data);
}
Any tips to debug or feedback is appreciated.