mirror of
https://github.com/mempool/mempool.git
synced 2025-02-23 06:35:15 +01:00
Merge pull request #5038 from mempool/mononaut/improve-deferred-mempool-animations
Improve deferred mempool visualization updates
This commit is contained in:
commit
375e43c191
2 changed files with 9 additions and 3 deletions
|
@ -238,7 +238,7 @@ export class BlockOverviewGraphComponent implements AfterViewInit, OnDestroy, On
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// collates non-urgent updates into a set of consistent pending changes
|
// collates deferred updates into a set of consistent pending changes
|
||||||
queueUpdate(add: TransactionStripped[], remove: string[], change: { txid: string, rate: number | undefined, acc: boolean | undefined }[], direction: string = 'left'): void {
|
queueUpdate(add: TransactionStripped[], remove: string[], change: { txid: string, rate: number | undefined, acc: boolean | undefined }[], direction: string = 'left'): void {
|
||||||
for (const tx of add) {
|
for (const tx of add) {
|
||||||
this.pendingUpdate.add[tx.txid] = tx;
|
this.pendingUpdate.add[tx.txid] = tx;
|
||||||
|
@ -262,9 +262,15 @@ export class BlockOverviewGraphComponent implements AfterViewInit, OnDestroy, On
|
||||||
this.pendingUpdate.count++;
|
this.pendingUpdate.count++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
deferredUpdate(add: TransactionStripped[], remove: string[], change: { txid: string, rate: number | undefined, acc: boolean | undefined }[], direction: string = 'left'): void {
|
||||||
|
this.queueUpdate(add, remove, change, direction);
|
||||||
|
this.applyQueuedUpdates();
|
||||||
|
}
|
||||||
|
|
||||||
applyQueuedUpdates(): void {
|
applyQueuedUpdates(): void {
|
||||||
if (this.pendingUpdate.count && performance.now() > (this.lastUpdate + this.animationDuration)) {
|
if (this.pendingUpdate.count && performance.now() > (this.lastUpdate + this.animationDuration)) {
|
||||||
this.update([], [], [], this.pendingUpdate?.direction);
|
this.applyUpdate(Object.values(this.pendingUpdate.add), Object.values(this.pendingUpdate.remove), Object.values(this.pendingUpdate.change), this.pendingUpdate.direction);
|
||||||
|
this.clearUpdateQueue();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -144,7 +144,7 @@ export class MempoolBlockOverviewComponent implements OnInit, OnDestroy, OnChang
|
||||||
if (blockMined) {
|
if (blockMined) {
|
||||||
this.blockGraph.update(delta.added, delta.removed, delta.changed || [], blockMined ? this.chainDirection : this.poolDirection, blockMined);
|
this.blockGraph.update(delta.added, delta.removed, delta.changed || [], blockMined ? this.chainDirection : this.poolDirection, blockMined);
|
||||||
} else {
|
} else {
|
||||||
this.blockGraph.queueUpdate(delta.added, delta.removed, delta.changed || [], this.poolDirection);
|
this.blockGraph.deferredUpdate(delta.added, delta.removed, delta.changed || [], this.poolDirection);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue