From c3963d6a0d1c25717f236815d80457cbdb33bafe Mon Sep 17 00:00:00 2001 From: natsoni Date: Thu, 27 Jun 2024 16:32:20 +0900 Subject: [PATCH] Fix acceleration preview showing with fragment on accel txs --- .../transaction/transaction.component.ts | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/frontend/src/app/components/transaction/transaction.component.ts b/frontend/src/app/components/transaction/transaction.component.ts index 570242a9a..c3421969b 100644 --- a/frontend/src/app/components/transaction/transaction.component.ts +++ b/frontend/src/app/components/transaction/transaction.component.ts @@ -747,6 +747,11 @@ export class TransactionComponent implements OnInit, AfterViewInit, OnDestroy { this.tx.acceleratedBy = cpfpInfo.acceleratedBy; this.setIsAccelerated(firstCpfp); } + + if (!this.isAcceleration && this.fragmentParams.has('accelerate')) { + this.onAccelerateClicked(); + } + this.txChanged$.next(true); this.cpfpInfo = cpfpInfo; @@ -884,14 +889,10 @@ export class TransactionComponent implements OnInit, AfterViewInit, OnDestroy { // simulate normal anchor fragment behavior applyFragment(): void { const anchor = Array.from(this.fragmentParams.entries()).find(([frag, value]) => value === ''); - if (anchor?.length) { - if (anchor[0] === 'accelerate') { - setTimeout(this.onAccelerateClicked.bind(this), 100); - } else { - const anchorElement = document.getElementById(anchor[0]); - if (anchorElement) { - anchorElement.scrollIntoView(); - } + if (anchor?.length && anchor[0] !== 'accelerate') { + const anchorElement = document.getElementById(anchor[0]); + if (anchorElement) { + anchorElement.scrollIntoView(); } } }