Skip to content

fix: stop the block counter flickering between networks in live mode - #61

Merged
moul merged 1 commit into
mainfrom
fix/live-aggregate
Aug 9, 2026
Merged

fix: stop the block counter flickering between networks in live mode#61
moul merged 1 commit into
mainfrom
fix/live-aggregate

Conversation

@moul

@moul moul commented Aug 9, 2026

Copy link
Copy Markdown
Collaborator

Closes #36.

With "all networks" selected and live mode on, the block counter visibly flipped back and forth — one networks tip, then anothers, then back.

Both live handlers wrote the shared counter unconditionally with whatever event had just arrived:

// onLiveTx
if (blockEl && tx.block_height > 0) blockEl.textContent = fmtNum(tx.block_height);
// onLiveBlock
if (blockEl) blockEl.textContent = fmtNum(block.height);

With independent SSE streams per network and chains at wildly different heights — topaz around 470k, gnoland1 around 3.14M — the display oscillated between them at whatever rate events arrived. onLiveBlock was the bigger offender, since block events are more frequent than transactions.

Fix

Tips are tracked per network (_liveTips) and only ever move forward. What gets displayed is then a rendering decision:

  • One network selected — that networks tip. Events from other networks are ignored rather than overwriting it.
  • All networks — the highest tip, which is stable and monotonic, with the actual per-network tips in the tooltip. There is no single "current block" across chains, so showing one number and hiding that fact would be worse than showing the breakdown on hover.

Verified in a browser

Interleaving events from two chains, as the feeds actually do:

event displayed before displayed now
topaz 470100 470 100 470 100
gnoland1 3162600 3 162 600 3 162 600
topaz 470101 470 101 3 162 600
gnoland1 3162601 3 162 601 3 162 601
topaz 470102 470 102 3 162 601

Monotonic, with gnoland1: 3 162 601 / topaz: 470 102 in the tooltip. With topaz selected, a gnoland1 event leaves the display untouched.

The other live counters (txs, calls, deploys, runs, sends) were already correct: they increment, and their baseline comes from /api/stats for the same network scope, so summing across networks is the right behavior there.

@moul
moul merged commit 14d691e into main Aug 9, 2026
4 checks passed
@moul
moul deleted the fix/live-aggregate branch August 9, 2026 12:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

live mode + all networks: header counters flicker between networks

1 participant