Hello, seems like the AngularFireDatabase is not handling empty lists in the observables.
constructor(private afDb: AngularFireDatabase) {}
// ommited code
public userExists(email: string): Observable<boolean> {
return this.afDb.list('/clients', ref =>
ref.orderByChild('email').equalTo(email))
.valueChanges()
.map((users: User[]) => users.length > 0);
}
When i call the method with an email that exists in my realtime database, everything is fine, but if the observable should return an empty list, it is not triggered.
Same here, also snapshotChanges() doesn麓t trigger when list is empty
K, I fixed in AFS I'll grab AFDB tonight + cut a new RC.
FYI this is a little trickier with RTDB + the new arch. Still in progress.
Thanks James
Heads up, getting this as well...
core firebase.js says a snapshot should return null if empty but with the latest angularFire I dont get anything until a value exists.
return this.af.list('/revisions/' + contentId + '/' + draftId).valueChanges(); and snapshotChanges() are both never firing their subscriptions..
but:
const ref = firebase.database().ref('/revisions/' + contentId + '/' + draftKey);
ref.once('value', snapshot => {
console.log('Firebase once returning:', snapshot.val());
fires with Firebase once returning:null
I had the listener setup with later functions init() binding inside the callback and my app just paused waiting for the callback....
Most helpful comment
FYI this is a little trickier with RTDB + the new arch. Still in progress.