Fix Plotly layout mutation blanking reliability tiles #10

Closed
ye0man wants to merge 0 commits from fix/analytics-plotly-layout into main
Owner

Problem

The Failure stage funnel, Blamed mints, and Error breakdown tiles rendered axes but no bars or labels on the live dashboard.

Root cause: public/dashboard.html shared a single layoutBase.xaxis/yaxis object across every Plotly.react call. Plotly writes inferred axis state back into the layout object it is handed, so the first chart's inferred yaxis.type = linear leaked into every later chart. Horizontal-bar tiles then coerced their string categories away. A second bug compounded it: emptyState() overwrote a live Plotly DOM without purging it, leaving Plotly's registry pointing at destroyed nodes, so a later react() silently drew nothing.

Fix

  • Add baseLayout(), which builds fresh nested xaxis/yaxis objects for every render.
  • Call Plotly.purge(el) in emptyState() before replacing innerHTML.
  • Mark the three categorical axes explicitly as type: category.

Verification

  • Headless browser against the live API: stages/blame/err-bar now report yaxis.type = category with 4/8/3 bars and their labels; every other tile is unchanged.
  • Selecting a mint filter and then Reset re-renders every tile with zero console errors.
  • Frontend-only change; cargo fmt --check is clean.
## Problem The Failure stage funnel, Blamed mints, and Error breakdown tiles rendered axes but no bars or labels on the live dashboard. Root cause: `public/dashboard.html` shared a single `layoutBase.xaxis`/`yaxis` object across every `Plotly.react` call. Plotly writes inferred axis state back into the layout object it is handed, so the first chart's inferred `yaxis.type = linear` leaked into every later chart. Horizontal-bar tiles then coerced their string categories away. A second bug compounded it: `emptyState()` overwrote a live Plotly DOM without purging it, leaving Plotly's registry pointing at destroyed nodes, so a later `react()` silently drew nothing. ## Fix - Add `baseLayout()`, which builds fresh nested `xaxis`/`yaxis` objects for every render. - Call `Plotly.purge(el)` in `emptyState()` before replacing `innerHTML`. - Mark the three categorical axes explicitly as `type: category`. ## Verification - Headless browser against the live API: stages/blame/err-bar now report `yaxis.type = category` with 4/8/3 bars and their labels; every other tile is unchanged. - Selecting a mint filter and then Reset re-renders every tile with zero console errors. - Frontend-only change; `cargo fmt --check` is clean.
Fix Plotly layout mutation blanking reliability tiles
All checks were successful
Validate auditor / check (pull_request) Successful in 9m42s
501d18670c
The dashboard shared one layoutBase.xaxis/yaxis object across every Plotly.react call. Plotly writes inferred axis state back into the layout it is given, so the first chart's inferred yaxis.type=linear leaked into every later chart. Horizontal bar tiles (Failure stage funnel, Blamed mints, Error breakdown) consequently rendered a numeric y-axis with no categories, labels, or bars. Build a fresh nested axis object per call via baseLayout() and mark categorical axes explicitly.

emptyState() also clobbered a live Plotly DOM without purging it, leaving Plotly's registry pointing at destroyed nodes so a later react() silently drew nothing. Purge before replacing innerHTML.
asmo closed this pull request 2026-09-14 06:10:47 +00:00
All checks were successful
Validate auditor / check (pull_request) Successful in 9m42s

Pull request closed

Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
cashubtc/auditor!10
No description provided.