Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions projects/components/src/table/data/table-cdk-data-source.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { DataSource } from '@angular/cdk/collections';
import { Dictionary, forkJoinSafeEmpty, isEqualIgnoreFunctions, RequireBy, sortUnknown } from '@hypertrace/common';
import { BehaviorSubject, combineLatest, NEVER, Observable, of, Subject, throwError } from 'rxjs';
import { BehaviorSubject, combineLatest, NEVER, Observable, of, Subject, Subscription, throwError } from 'rxjs';
import { catchError, debounceTime, map, mergeMap, startWith, switchMap, tap } from 'rxjs/operators';
import { PageEvent } from '../../paginator/page.event';
import { PaginationProvider } from '../../paginator/paginator-api';
Expand Down Expand Up @@ -37,6 +37,7 @@ export class TableCdkDataSource implements DataSource<TableRow> {
private readonly loadingStateSubject: Subject<TableLoadingState> = new BehaviorSubject<TableLoadingState>({
loading$: NEVER
});
private changeSubscription?: Subscription;

public loadingStateChange$: Observable<TableLoadingState> = this.loadingStateSubject.asObservable();

Expand All @@ -54,7 +55,7 @@ export class TableCdkDataSource implements DataSource<TableRow> {
****************************/

public connect(): Observable<ReadonlyArray<TableRow>> {
this.buildChangeObservable()
this.changeSubscription = this.buildChangeObservable()
.pipe(
tap(() => this.loadingStateSubject.next({ loading$: NEVER })),
/**
Expand All @@ -80,6 +81,7 @@ export class TableCdkDataSource implements DataSource<TableRow> {
}

public disconnect(): void {
this.changeSubscription?.unsubscribe();
this.rowsChange$.complete();
this.loadingStateSubject.complete();
}
Expand Down