Skip to content

Commit

Permalink
create TrackByFunction for templateTabLinks
Browse files Browse the repository at this point in the history
  • Loading branch information
infacc committed Jul 7, 2023
1 parent 3e9b1e5 commit 04a1765
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ <h3 mat-subheader>Create New Template Tab</h3>
</mat-expansion-panel>
<mat-divider></mat-divider>

<ng-container *ngFor="let group of templateTabLinks | keyvalue: tabOrder">
<ng-container *ngFor="let group of templateTabLinks | keyvalue:tabOrder; trackBy:trackByTabLink">
<h3 mat-subheader>{{tabGroupNameOverrides[group.key] ?? group.key}}</h3>
<mat-expansion-panel *ngFor="let tab of group.value" [expanded]="tabId == tab.resourceKey?.uiTemplateTabId"
(afterExpand)="selectTab(tab.resourceKey?.uiTemplateTabId ?? 'null')" (closed)="deselectTab(tab.resourceKey?.uiTemplateTabId ?? null)"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export class ExperimentWorkspaceDetailComponent implements OnInit {

readonly separatorKeysCodes = [ENTER, COMMA] as const;

tabGroupNameOverrides = {...TAB_GROUP_NAME_OVERRIDES};
tabGroupNameOverrides = { ...TAB_GROUP_NAME_OVERRIDES };

templateId: string | null = null;
tabId: string | null = null;
Expand Down Expand Up @@ -342,4 +342,6 @@ export class ExperimentWorkspaceDetailComponent implements OnInit {
const bSortKey = TAB_GROUP_SORT_KEYS[b.key] ?? 0;
return aSortKey - bSortKey;
}

trackByTabLink = (index: number, item: KeyValue<string, ApiLink[]>) => item.value.map(link => link.href).join(',');
}

0 comments on commit 04a1765

Please sign in to comment.