Skip to content

fix(frontend): back-button flash, network-switch leak, red incoming blocks, scroll drift - #38

Merged
owenwahlgren merged 1 commit into
mainfrom
fix/frontend-bugs-back-net-red-drift
May 4, 2026
Merged

owenwahlgren merged 1 commit into
mainfrom
fix/frontend-bugs-back-net-red-drift

Conversation

@owenwahlgren

Copy link
Copy Markdown
Collaborator

Four user-reported bugs.

Fixes

  1. Back-button fade flash — app/template.tsx re-keys per segment so the page-fade animation replays over cached content. Now skip the fade when nav came from popstate.
  2. Network-switch leak — mergeTickIntoBootstrap ignored its closure-captured apiBase and asked firnQueryKey() (which reads getApiBase() live), so an in-flight tick from the old network landed in the new network's cache. Use the captured arg.
  3. Red incoming-block highlight — LiveBlocksList head row → switched from --accent-soft/--accent-ink (red) to --good-soft/--good (green).
  4. Scroll drifts down on /blocks — useNowTick(100) was re-rendering the whole heavy page 10×/sec, disengaging scroll anchor mid-CSS-animation. Lowered to 1s default.

Test plan

  • pnpm typecheck — clean
  • pnpm lint — clean
  • pnpm format:check — clean

…locks, scroll drift

Four user-reported bugs:

1. back button on any page shows a 400ms loading flash — caused by
   app/template.tsx re-keying per segment which replays the page-fade
   animation (opacity 0→1, staggered children) over content already
   in the React Query cache. Now a popstate listener flips a module-
   scoped flag; the template skips the fade class when the nav came
   from back/forward. Forward navigations still get the entrance.

2. switching networks on the home page leaves the previous network's
   blocks in the live panel for a beat. Caused by mergeTickIntoBootstrap
   in lib/api/explorer.ts: it ignored its closure-captured apiBase arg
   and asked firnQueryKey() for the key, which reads getApiBase() at
   call time. setApiBase() runs synchronously inside setNetwork() —
   before React commits the new state and tears down the old EventSource
   — so an in-flight tick from the OLD network builds a key against
   the NEW network and dumps testnet payload into local cache. Now
   we build the key directly from the captured apiBase.

3. red highlight on the latest block in /blocks LiveBlocksList — was
   var(--accent-soft) / var(--accent-ink) (red, hue 25°). Switched the
   nine occurrences to var(--good-soft) / var(--good) (green, hue 145°).

4. /blocks page felt like it was drifting downward as new blocks
   landed. useNowTick(100) re-rendered the whole page (huge animated
   headline, 50-row table, 3 charts, 4 KPIs, live list, fresh-row
   animations) ten times a second; scroll anchor disengaged under
   that re-render rate concurrent with running CSS animations.
   Lowered to the 1s default — formatRelativeTime rounds to whole
   seconds anyway.
@owenwahlgren
owenwahlgren merged commit 09bdb8d into main May 4, 2026
3 checks passed
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.

1 participant