Currently, I am facing an issue in my code where I am trying to introduce a delay using timer(500). However, the problem is that it is only returning partial data. Instead of the expected 17 fields, it is only returning 2 fields. Below is my code snippet for reference. Please take a look. Thank you.
Returned value:
['booking_display_id', 'edit']
Expected value:
['booking_display_id', 'bookingstatus', 'b_contactname', 'member', 'b_emailaddress', 'b_mobilenumber', 'startdate', 'enddate', 'duration', 'bookingguest', 'guestnotes', 'vouchers', 'paypalpaymentpdt', 'totalCost', 'canPay', 'canCancel', 'edit']
this.displayedColumns = combineLatest(this.table.columns.reduce((observables: Observable<boolean>[], col) => {
// handle showIf property of column
const show = col.showIf(this.injector, this.route.queryParamMap);
observables.push(show instanceof Observable ? show : of(show));
return observables;
}, []), timer(500)).pipe(
map(showCols => {
const cols = this.table.columns.filter((c, i) => showCols[i])
.map(c => c.id);
this.editEnabled && cols.push('edit');
this.deleteEnabled && cols.push('delete');
console.log('cols', cols)
return cols;
})
);