From e70fd0045d70df40dc49bb73548254df56977c9f Mon Sep 17 00:00:00 2001 From: Miguel Medeiros Date: Wed, 19 May 2021 19:03:59 -0300 Subject: [PATCH] Fix tx-list load is being constantly triggered. (#531) --- .../transactions-list/transactions-list.component.ts | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/frontend/src/app/components/transactions-list/transactions-list.component.ts b/frontend/src/app/components/transactions-list/transactions-list.component.ts index cce2cee20..ed536f106 100644 --- a/frontend/src/app/components/transactions-list/transactions-list.component.ts +++ b/frontend/src/app/components/transactions-list/transactions-list.component.ts @@ -74,7 +74,14 @@ export class TransactionsListComponent implements OnInit, OnChanges { } onScroll() { - this.loadMore.emit(); + const scrollHeight = document.body.scrollHeight; + const scrollTop = document.documentElement.scrollTop; + if(scrollHeight > 0){ + const percentageScrolled = scrollTop * 100 / scrollHeight; + if(percentageScrolled > 90){ + this.loadMore.emit(); + } + } } getTotalTxOutput(tx: Transaction) {