Optimization for bisq transaction table rendering

This commit is contained in:
softsimon 2020-08-11 00:43:24 +07:00
parent 95bab64424
commit dd0b67716f
No known key found for this signature in database
GPG Key ID: 488D7DCFB5A430D7
3 changed files with 7 additions and 1 deletions

View File

@ -77,5 +77,7 @@ export class BisqIconComponent implements OnChanges {
this.iconProp[1] = 'question';
this.color = 'ffac00';
}
// @ts-ignore
this.iconProp = this.iconProp.slice();
}
}

View File

@ -22,7 +22,7 @@
<th class="d-none d-md-block">Height</th>
</thead>
<tbody *ngIf="transactions.value; else loadingTmpl">
<tr *ngFor="let tx of transactions.value[0]">
<tr *ngFor="let tx of transactions.value[0]; trackBy: trackByFn">
<td><a [routerLink]="['/tx/' | relativeUrl, tx.id]" [state]="{ data: tx }">{{ tx.id | slice : 0 : 8 }}</a></td>
<td class="d-none d-md-block">
<app-bisq-icon class="mr-1" [txType]="tx.txType"></app-bisq-icon>

View File

@ -173,4 +173,8 @@ export class BisqTransactionsComponent implements OnInit {
calculateTotalOutput(outputs: BisqOutput[]): number {
return outputs.reduce((acc: number, output: BisqOutput) => acc + output.bsqAmount, 0);
}
trackByFn(index: number) {
return index;
}
}