Skip to content

fix(ui): show StatUnavailable when KPI source queries fail (#8818) - #8935

Closed
kurosawareiji7007-hub wants to merge 1 commit into
JSONbored:mainfrom
kurosawareiji7007-hub:fix/ui-stat-phase-8818-v6
Closed

fix(ui): show StatUnavailable when KPI source queries fail (#8818)#8935
kurosawareiji7007-hub wants to merge 1 commit into
JSONbored:mainfrom
kurosawareiji7007-hub:fix/ui-stat-phase-8818-v6

Conversation

@kurosawareiji7007-hub

Copy link
Copy Markdown
Contributor

Closes #8818

Supersedes closed #8933 (maintainer: Total stake showed Coins glyph + StatUnavailable together on desktop/tablet), #8926, #8905, #8901, #8899.

Desktop/tablet fix (vs #8933)

The compact masthead "Total stake" strip always rendered the decorative Coins icon beside the figure. On error that produced Coins + AlertCircle + "Unavailable". The Coins glyph now only renders on the ready branch with formatTao(...).

Summary

Four KPI surfaces rendered a confident 0 / "no positions" / "Unset" when their source useQuery failed. Wired each through statPhase + StatUnavailable.

StatUnavailable now uses h-[1em] so error tiles match the parent KPI value-line height (StatTile display metrics) instead of collapsing to text-sm beside numeric neighbours.

What changed

  1. /subnets Total stake — statPhase(economicsRes)
  2. /accounts/<ss58> Positions — portfolioPhase={statPhase(portfolioResult)} into AccountKpiBand
  3. /subnets/<netuid>?tab=activity ActivityEventRollup — independent phases; dual failure still renders Unavailable tiles
  4. /chain/governance Sudo key — error → StatUnavailable

Test plan

  • Source-assertion suites for all four sites
  • Forced-503 capture with wait for visible Unavailable (account/subnets/sudo/subnet rollup)
  • Confirmed after account shot shows Positions → Unavailable (not portfolioResult is not defined)
  • Full Desktop/Tablet/Mobile × Light/Dark before/after matrix (fixed viewport, mg-theme)
  • CI green on this PR

Screenshots

Blocked: /api/v1/economics, .../portfolio, .../event-summary, .../axon-removals, /api/v1/sudo/key.

/subnets Total stake

Viewport · Theme Before After
Desktop · Light
before

after
Desktop · Dark
before

after
Tablet · Light
before

after
Tablet · Dark
before

after
Mobile · Light
before

after
Mobile · Dark
before

after

Account Positions KPI

Viewport · Theme Before After
Desktop · Light
before

after
Desktop · Dark
before

after
Tablet · Light
before

after
Tablet · Dark
before

after
Mobile · Light
before

after
Mobile · Dark
before

after

/subnets/1?tab=activity Activity rollup

Viewport · Theme Before After
Desktop · Light
before

after
Desktop · Dark
before

after
Tablet · Light
before

after
Tablet · Dark
before

after
Mobile · Light
before

after
Mobile · Dark
before

after

Governance Sudo key

Viewport · Theme Before After
Desktop · Light
before

after
Desktop · Dark
before

after
Tablet · Light
before

after
Tablet · Dark
before

after
Mobile · Light
before

after
Mobile · Dark
before

after

…#8818)

Phase Total stake, Positions, ActivityEventRollup, and Sudo key through
statPhase so a failed request cannot fabricate 0 / no positions / Unset.
Pass portfolioPhase into AccountKpiBand. Size StatUnavailable with h-[1em]
to match KPI value-line height. Keep the Total stake Coins glyph only on
the ready branch so it never sits beside the error indicator.
@loopover-orb

loopover-orb Bot commented Jul 31, 2026

Copy link
Copy Markdown
Contributor

Important

🟨🟨🟨🟨🟨🟨🟨🟨🟨🟨🟨🟨

⏳ LoopOver is waiting…

LoopOver has seen this pull request and is waiting on CI checks to finish before reviewing it. This comment will update once the review runs.

🟩 Safe / merged · 🟦 Advisory · 🟨 Held for review · 🟥 Blocked / closed · 🟨 Waiting

@superagent-security

Copy link
Copy Markdown

Superagent didn't find any vulnerabilities or security issues in this PR.

@codecov

codecov Bot commented Jul 31, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 97.93%. Comparing base (46f6c56) to head (9cf2f51).
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #8935   +/-   ##
=======================================
  Coverage   97.93%   97.93%           
=======================================
  Files         450      450           
  Lines       31585    31585           
  Branches    11778    11778           
=======================================
  Hits        30934    30934           
  Misses        150      150           
  Partials      501      501           
🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@JSONbored JSONbored left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does not look any different from the previous attempts. Closing.

@JSONbored JSONbored closed this Jul 31, 2026
@loopover-orb loopover-orb Bot added the gittensor:bug Gittensor-scored bug fix or unsolicited PR — scores a 0.05x multiplier. label Jul 31, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

gittensor:bug Gittensor-scored bug fix or unsolicited PR — scores a 0.05x multiplier.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix(ui): four stat surfaces render a fabricated 0 (and /sudo a false "Unset") when their query failed

2 participants