Skip to content

Commit

Permalink
add trackby
Browse files Browse the repository at this point in the history
  • Loading branch information
cetincakiroglu committed Nov 29, 2023
1 parent e17b178 commit f492436
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/app/showcase/layout/doc/app.docsection.component.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { ChangeDetectionStrategy, Component, Input } from '@angular/core';
import { ChangeDetectionStrategy, Component, Input, signal } from '@angular/core';
import { Doc } from 'src/app/showcase/domain/doc';

@Component({
selector: 'app-docsection',
template: `
<ng-container *ngIf="docs && docs.length">
<section class="py-4" *ngFor="let doc of docs">
<section class="py-4" *ngFor="let doc of docs; trackBy: trackById">
<ng-container *ngIf="!doc.component && doc.children">
<app-docsectiontext [title]="doc.label" [id]="doc.id" [level]="2" />
Expand All @@ -23,7 +23,7 @@ import { Doc } from 'src/app/showcase/domain/doc';
</ng-container>
<ng-container *ngIf="apiDocs && apiDocs.length">
<section class="py-4" *ngFor="let doc of apiDocs">
<section class="py-4" *ngFor="let doc of apiDocs; trackBy: trackById">
<ng-container *ngIf="doc.children">
<app-docsectiontext [title]="doc.label" [id]="doc.id" [description]="doc.description" [level]="2" />
Expand All @@ -40,4 +40,8 @@ export class AppDocSectionsComponent {
@Input() docs!: Doc[];

@Input() apiDocs!: any[];

trackById(doc) {
return doc.id || undefined;
}
}

1 comment on commit f492436

@vercel
Copy link

@vercel vercel bot commented on f492436 Nov 29, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.