Skip to content

fix(ui-kit): render chart tooltip zero inside tabular-nums span - #10114

Merged
loopover-orb[bot] merged 1 commit into
JSONbored:mainfrom
RealDiligent:fix/ui-kit-chart-tooltip-zero-10051
Jul 31, 2026
Merged

fix(ui-kit): render chart tooltip zero inside tabular-nums span#10114
loopover-orb[bot] merged 1 commit into
JSONbored:mainfrom
RealDiligent:fix/ui-kit-chart-tooltip-zero-10051

Conversation

@RealDiligent

Copy link
Copy Markdown
Contributor

Summary

  • Replace ChartTooltipContent's truthiness guard (item.value &&) with an explicit nullish check so numeric 0 renders inside the tabular-nums span via toLocaleString() instead of as a bare React text child.
  • Empty string also goes through the span; only undefined / null omit the value element.
  • Custom formatter branch unchanged.

Closes #10051

Test plan

  • npm --workspace @loopover/ui-kit run test -- src/components/chart.test.tsx (13 pass)
  • Zero value sits inside span.tabular-nums (not a direct text child)
  • undefined / null omit the value span; "" renders empty span
  • Existing 120/80 labelled-row test unmodified and still passing

@RealDiligent
RealDiligent requested a review from JSONbored as a code owner July 31, 2026 07:39
@loopover-orb

loopover-orb Bot commented Jul 31, 2026

Copy link
Copy Markdown
Contributor

Tip

✅ LoopOver review result - approve/merge recommended

Review updated: 2026-07-31 07:54:23 UTC

2 files · 1 AI reviewer · no blockers · readiness 86/100 · CI green · clean

✅ Suggested Action - Approve/Merge

  • safe to merge

Review summary
This diff fixes a real bug: `item.value && (...)` in ChartTooltipContent skipped the tabular-nums span for falsy-but-valid values like `0` and `""`, rendering them as bare text or nothing. The replacement `item.value !== undefined && item.value !== null` is correct and matches the existing `formatter && item?.value !== undefined` pattern already used a few lines above in the same file. Tests added are well-targeted, exercise both the zero and empty-string cases and the undefined/null omission cases, and the diff correctly links to issue #10051.

Nits — 4 non-blocking
  • chart.tsx:257 — for non-numeric values (e.g. strings), `.toLocaleString()` still works but has no real formatting effect; consider a comment noting `toLocaleString` is meant for numeric display only, though this isn't a regression introduced here.
  • chart.test.tsx — the three new tests are somewhat verbose (particularly the DOM-traversal check for `directZero`); a simpler `container.textContent` vs `valueSpan.textContent` comparison would communicate the same invariant with less code.
  • Consider consolidating the `undefined`/`null` check into a single `item.value == null` for brevity, though the explicit form is also fine and arguably clearer.
  • The empty-string test asserts an empty span renders — worth double-checking this is desired product behavior (an invisible tabular-nums span) rather than also omitting it, since it's a UI-visible edge case not explicitly mentioned in the linked issue.

Decision drivers

  • ✅ Code review — No blockers (1 reviewer)
  • ✅ Gate result — Passing (No configured blocker found.)
Context & advisory signals — never blocks the verdict
Signal Result Evidence
Linked issue ✅ Linked #10051
Related work ✅ No active overlap found No same-issue or scoped active PR overlap found.
Change scope ❌ 8/20 High review scope from cached public metadata (1 linked issue).
Validation posture ✅ 25/25 PR body includes validation/test evidence.
Contributor workload ✅ 10/10 Author activity: 239 registered-repo PR(s), 89 merged, 38 issue(s).
Contributor context ✅ Confirmed Gittensor contributor RealDiligent; Gittensor profile; 239 PR(s), 38 issue(s).
Improvement ✅ Minor risk: clean · value: minor · LLM: minor
Linked issue satisfaction

Addressed
The diff replaces the truthy `&&` guard with an explicit `item.value !== undefined && item.value !== null` check, leaving the formatter branch untouched, and adds tests in chart.test.tsx covering zero rendering inside the tabular-nums span, undefined/null omission, and empty-string rendering as required by the deliverables.

Review context
  • Author: RealDiligent
  • Role context: outside_contributor
  • Public audience mode: oss maintainer
  • Lane context: Repository is configured for direct PR review.
  • Public profile languages: Python, Ruby, TypeScript, Svelte, Cuda, JavaScript, Markdown, MDX
  • Official Gittensor activity: 239 PR(s), 38 issue(s).
  • PR-specific overlap: none found.
Contributor next steps
  • Start here: Add a concise scope and risk note.
  • Then work through the remaining 1 step in the Signals table above.
Signal definitions
  • Related work = same linked issue, overlapping active PRs, or title/path similarity.
  • Change scope = cached public metadata such as size labels, draft state, and review-burden hints.
  • Validation posture = whether the PR provides enough public validation/test evidence for maintainer review.
  • Contributor workload = public contributor activity and cleanup pressure, not a repo-wide quality failure.
  • Contributor context = public GitHub/Gittensor identity context; non-Gittensor status is not a blocker.
🧪 Chat with LoopOver

Ask LoopOver a question about this PR directly in a comment — grounded only in the same cached, public-safe facts shown above, never a new claim.

  • @loopover ask <question> answers contribution-quality Q&A with source citations and freshness.
  • @loopover chat <question> answers in natural prose from cached decision-pack facts via local inference (maintainer/collaborator; read-only).
  • A plain-language @loopover mention with a real question is routed to the closest matching read-only command automatically — no exact syntax required.

Full command reference: https://loopover.ai/docs/loopover-commands

🧪 Experimental — new and may change.

Visual preview
Route Viewport Before (production) After (this PR's preview) Diff
/ desktop before /
before /
after /
after /
/ mobile before / (mobile)
before / (mobile)
after / (mobile)
after / (mobile)

Click any thumbnail to open the full-size screenshot. Before = production · After = this PR's preview deploy.

Scroll preview
Route Before (production) After (this PR's preview)
/ before / (scroll)
before / (scroll)
after / (scroll)
after / (scroll)

A short scroll-through clip (desktop) — click either thumbnail to open the full animation. Evidence for scroll-linked behavior a single screenshot can't show.

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


💰 Earn for open-source contributions like this. Gittensor lets GitHub contributors earn for the work they already do — register to start earning →.

Checked by LoopOver, a quiet PR intelligence layer for OSS maintainers.

  • Re-run LoopOver review

@superagent-security

Copy link
Copy Markdown
Contributor

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

Replace the truthiness guard on ChartTooltipContent value with an
explicit nullish check so 0 and empty string go through toLocaleString
in the formatted span instead of a bare React text child.

Closes JSONbored#10051

Co-authored-by: Cursor <cursoragent@cursor.com>
@loopover-orb loopover-orb Bot added the gittensor:bug Gittensor-scored bug fix — scores a 0.05x multiplier. label Jul 31, 2026

@loopover-orb loopover-orb Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LoopOver approves — the gate is satisfied and CI is green.

@loopover-orb
loopover-orb Bot merged commit 21855f2 into JSONbored:main Jul 31, 2026
8 checks passed
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 — scores a 0.05x multiplier.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ui-kit(chart): ChartTooltipContent renders a zero value as a bare unstyled "0" instead of a formatted number

2 participants