File tree Expand file tree Collapse file tree 2 files changed +4
-0
lines changed Expand file tree Collapse file tree 2 files changed +4
-0
lines changed Original file line number Diff line number Diff line change @@ -14,4 +14,5 @@ export interface CollectionViewer {
14
14
15
15
export abstract class DataSource < T > {
16
16
abstract connect ( collectionViewer : CollectionViewer ) : Observable < T [ ] > ;
17
+ disconnect ( ) { }
17
18
}
Original file line number Diff line number Diff line change @@ -179,6 +179,7 @@ export class CdkTable<T> implements CollectionViewer {
179
179
ngOnDestroy ( ) {
180
180
this . _onDestroy . next ( ) ;
181
181
this . _onDestroy . complete ( ) ;
182
+ this . dataSource . disconnect ( ) ;
182
183
}
183
184
184
185
ngOnInit ( ) {
@@ -231,6 +232,8 @@ export class CdkTable<T> implements CollectionViewer {
231
232
*/
232
233
private _switchDataSource ( dataSource : DataSource < T > ) {
233
234
this . _data = [ ] ;
235
+
236
+ this . dataSource . disconnect ( ) ;
234
237
this . _dataSource = dataSource ;
235
238
236
239
if ( this . _isViewInitialized ) {
You can’t perform that action at this time.
0 commit comments