I have the following code block in my ngOnInit
as below:
this.subscriptions = this.formService.getFormFromApi(this.formId)
.pipe(
concatMap(theForm => this.formService.getFormStructure(theForm))
).pipe(
take(1),
tap(tree => { this.treeNodeData = tree; }),
(finalize(() => this.isTreeLoading = false))
).subscribe();
...
this.subscriptions.add(
combineLatest(
this.fileService.getFiles(this.formId),
this.formService.questionsList
).pipe(
tap(arrResult => {
this.fileData = arrResult[0];
this.test = arrResult[1];
console.log("fired.")
})
).subscribe()
);
...
The idea is as below:
When the column definition changes as determined by the questionsList
, I wish to re-render the the table. I plan to do this by getting the files again (Don't worry about calling http repeatedly. When this works, I will replace the logic with something more efficient)
However, even when the BehaviorSubject
is changing values (columns to display in table) all the time, the result does not get refreshed. Basically, "fired" does not run after the first time when the page loads.
Why is this happening? Is it because the http call has completed and the questionsList
has not? I had the notion that combineLatest
will fire as long as one of the observables emit something?