Add trackby function so cdktree can differentiate between new and old nodes

(cherry picked from commit 5f71de885b)
This commit is contained in:
Hrafn Malmquist
2023-08-22 04:28:28 +01:00
committed by github-actions[bot]
parent 46ac61dcac
commit 9fc4e213df
2 changed files with 2 additions and 1 deletions

View File

@@ -1,5 +1,5 @@
<ds-themed-loading *ngIf="(dataSource.loading$ | async) && !loadingNode" class="ds-themed-loading"></ds-themed-loading>
<cdk-tree [dataSource]="dataSource" [treeControl]="treeControl">
<cdk-tree [dataSource]="dataSource" [treeControl]="treeControl" [trackBy]="trackBy">
<!-- This is the tree node template for show more node -->
<cdk-tree-node *cdkTreeNodeDef="let node; when: isShowMore" cdkTreeNodePadding
class="example-tree-node show-more-node">

View File

@@ -30,6 +30,7 @@ export class CommunityListComponent implements OnInit, OnDestroy {
);
dataSource: CommunityListDatasource;
trackBy = (index, node: FlatNode) => node.id;
paginationConfig: FindListOptions;