Skip to content

Commit 8286fe1

Browse files
author
Micah Riggan
committed
feature(insight): load more txs
Instead of loading them all into the dom at once, load 10, and then exponentially load more
1 parent bbfabac commit 8286fe1

File tree

2 files changed

+15
-2
lines changed

2 files changed

+15
-2
lines changed

packages/insight-previous/src/components/transaction-list/transaction-list.html

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,15 @@
55

66
<div *ngIf="!loading">
77
<ion-grid>
8-
<ion-row *ngFor="let tx of transactions">
9-
<ion-col col-12>
8+
<ion-row *ngFor="let tx of transactions; let i = index">
9+
<ion-col col-12 *ngIf="i < limit">
1010
<transaction [tx]="tx"></transaction>
1111
</ion-col>
1212
</ion-row>
13+
<ion-row *ngIf="limit < transactions.length">
14+
<ion-col col-12 text-center (click)="loadMore()">
15+
<a>Load More</a>
16+
</ion-col>
17+
</ion-row>
1318
</ion-grid>
1419
</div>

packages/insight-previous/src/components/transaction-list/transaction-list.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@ export class TransactionListComponent implements OnInit {
1515
@Input()
1616
public transactions?: any = [];
1717

18+
limit = 10;
19+
chunkSize = 100;
20+
1821
constructor(private txProvider: TxsProvider) {}
1922

2023
ngOnInit(): void {
@@ -33,4 +36,9 @@ export class TransactionListComponent implements OnInit {
3336
this.loading = false;
3437
}
3538
}
39+
40+
loadMore() {
41+
this.limit += this.chunkSize;
42+
this.chunkSize *= 2;
43+
}
3644
}

0 commit comments

Comments
 (0)