Skip to content

Commit

Permalink
Add trackby function so cdktree can differentiate between new and old…
Browse files Browse the repository at this point in the history
… nodes
  • Loading branch information
J4bbi committed Aug 22, 2023
1 parent 05c53ad commit 5f71de8
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -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">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ export class CommunityListComponent implements OnInit, OnDestroy {
);

dataSource: CommunityListDatasource;
trackBy = (index, node: FlatNode) => node.id;

paginationConfig: FindListOptions;

Expand Down

0 comments on commit 5f71de8

Please sign in to comment.