load block/tx pages at correct blockchain scroll position

This commit is contained in:
Mononaut committed 2023-01-06 10:13:53 -06:00
1 parent 32bf30872d
commit bf941b0227
9 files changed
+40 -11

No files matched your search

+1 -1
View File
@@ -5,7 +5,7 @@ import { BlockExtended } from '../interfaces/node-api.interface';
import { StateService } from './state.service';
import { ApiService } from './api.service';
const BLOCK_CACHE_SIZE = 50;
const BLOCK_CACHE_SIZE = 500;
const KEEP_RECENT_BLOCKS = 50;
@Injectable({
@@ -224,12 +224,14 @@ export class WebsocketService {
handleResponse(response: WebsocketResponse) {
if (response.blocks && response.blocks.length) {
const blocks = response.blocks;
let maxHeight = 0;
blocks.forEach((block: BlockExtended) => {
if (block.height > this.stateService.latestBlockHeight) {
this.stateService.updateChainTip(block.height);
maxHeight = Math.max(maxHeight, block.height);
this.stateService.blocks$.next([block, false]);
}
});
this.stateService.updateChainTip(maxHeight);
}
if (response.tx) {