Add track by function to tab bar

Signed-off-by: trivernis <trivernis@protonmail.com>
pull/3/head
trivernis 3 years ago
parent 4568afe6f9
commit 570a2e1b78
Signed by: Trivernis
GPG Key ID: DFFFCC2C7A02DB45

@ -4,7 +4,7 @@
<mat-tab [label]="this.selectedRepository? 'RepositoryData' : 'Repositories'">
<app-repositories-tab></app-repositories-tab>
</mat-tab>
<mat-tab *ngFor="let tab of tabs">
<mat-tab *ngFor="let tab of tabs; trackBy: trackByTabId">
<ng-template mat-tab-label>
<div (click)="this.onMouseClickTabLabel(tab, $event)" class="tab-label-div">
{{tab.category}}

@ -27,7 +27,8 @@ export class CoreComponent {
private tabService: TabService,
private repoService: RepositoryService,
private stateService: StateService,
private tagService: TagService) {
private tagService: TagService
) {
this.selectedRepository = this.repoService.selectedRepository.getValue();
this.repoService.selectedRepository.subscribe(async (selected) => {
@ -114,4 +115,8 @@ export class CoreComponent {
await this.closeTab(tab);
}
}
public trackByTabId(index: number, item: TabState) {
return item.uuid;
}
}

Loading…
Cancel
Save