I'm using Rxjs 6 which filters an observable returned by Firebase based on (keyup) event in a form field.
I have an issue when the user keeps pressing backspace while there is no value in the form field, then it looks like the observable is constantly refreshed.
Adding a pipe with DistinctUntilChanged() doesn't seem to be effective:
Typescript Filter Function:
updateFilter2() {
    const val = this.filteredValue.toLowerCase().toString().trim();
    if (this.filteredValue) {
        this.loadingIndicator = true;
        this.rows = this.svc.getData()
            .pipe(
                distinctUntilChanged(),
                debounceTime(300),
                map(_co => _co.filter(_company =>
                    _company['company'].toLowerCase().trim().indexOf(val) !== -1 || !val
                    ||
                    _company['name'].toLowerCase().trim().indexOf(val) !== -1 || !val
                    ||
                    _company['gender'].toLowerCase().trim().indexOf(val) !== -1 || !val
                )),
                tap(res => {
                    this.loadingIndicator = false;
                })
            );
    }
    else {
        this.rows = this.svc.getData()
            .pipe(distinctUntilChanged())
        this.loadingIndicator = false;
    }
    this.table.offset = 0;
}
HTML Template:
<mat-form-field style="padding:8px;">
    <input
            type='text'
            matInput
            [(ngModel)] = "filteredValue"
            style='padding:8px;margin:15px auto;width:30%;'
            placeholder='Type to filter the name column...'
            (input)='updateFilter2()'
    />
</mat-form-field>
I have a Stackblitz reproducing the behaviour: https://stackblitz.com/edit/angular-nyqcuk
Is there any other way to address it ?
Thanks