I'm using forkJoin to combine the results of two firebase requests
Both requests complete and log within the console, but the map function for the forkJoin itself does not fire and hence no results are returned to the application
public initGroup(groupname, username){
console.log(groupname, username)//This logs
return Observable.forkJoin([
this.getGroup(groupname, username),
this.groupMembers(username, groupname),
])
.map((data)=>{
console.log(data)//This does not log
this.group = data;
return this.group
})
}
And for the individual functions:
public getGroup(groupname, username){
return (this._af.database.object('/groups/'+groupname) as FirebaseObjectObservable<any>)
.map((group)=>{
console.log(group)//This logs
return group
})
}
public groupMembers(username, groupname){
return this.afService.getUserItems(groupname)
.map((users:UserInfo[])=>{
console.log(users)//This logs
return users
})
}
I subscribe within the component:
let conn = this.groupService.initGroup(groupname, username)
.subscribe((data)=>{
console.log(data)//Does not log
......
})
This is my use case with
Firestore
.It turns out forkJoin just doesn't work with firebase observables,
When I updated to
combineLatest made it work as expected