the main thing here: the both input Observable emit values, those values aren't null and they both completed. What else I could miss?
this.availableHours$.subscribe(res => console.log(res));
this.selectedDays$.subscribe(res => console.log(res));
forkJoin([this.availableHours$, this.engagedTime$]).subscribe(() => console.log('hello'));
I checked if they completed and emit values by separate console.log for each one. And result is:
{ availableHoursByDay: undefined } // availableHours$
{ startDate: '23.09', endDate: '25.09' } // selectedDays
{ availableHoursByDay: uundefined } // availableHours$
{ availableHoursByDay: uundefined } // availableHours$
{ availableHoursByDay: { '23.09': 1,2,3,4, '25.09': 7,4,6 } } // availableHours$
And 'hello' in forkJoin was not output to the console :(
So it really looks like they are completed and emit not null values. Both Observables are from store (they were received one from api call and other from routeParams and then stored to store)
What else I'm missing here?
UPDATE. According to comments (guys thank you very much) I find out that the store Observables are never completed (almost never).
So now I have another question:
I need to track changes from selectedDays$ and to take only the very last emitted value by availableHours$ (whith not undefined properties). Only one the last. This is very important that only one
I implemented combineLatest in this way
combineLatest([this.selectedDays$, availableHours$.pipe(
filter(availableHours => !!availableHours.availableHoursByDay),
first()
))
.subscribe(([datesRange, availableHours]) => {
this.processBookingDatesChange(datesRange, availableHours);
});
but I was looking for something more elegant. What can I do here?
availableHours$orselectedDays$are selectors from a store, then almost certainly they don't complete. You can check that withsubscribe({ next: console.log, complete: () => console.log('complete') })- martin