fix: stop the block counter flickering between networks in live mode - #61
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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:
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.
onLiveBlockwas 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:Verified in a browser
Interleaving events from two chains, as the feeds actually do:
Monotonic, with
gnoland1: 3 162 601 / topaz: 470 102in 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/statsfor the same network scope, so summing across networks is the right behavior there.