Skip to content

fix(web): compact notation defaults to 2 fraction digits, not 4 - #10

Open
draevik wants to merge 1 commit into
lightchain-protocol:mainfrom
draevik:fix/compact-precision-followup
Open

fix(web): compact notation defaults to 2 fraction digits, not 4#10
draevik wants to merge 1 commit into
lightchain-protocol:mainfrom
draevik:fix/compact-precision-followup

Conversation

@draevik

@draevik draevik commented Aug 10, 2026

Copy link
Copy Markdown
Contributor

What this fixes

Non-blocking follow-up from review on the market cap overflow fix.

formatNumber's default maximumFractionDigits: 4 was carrying into compact notation too, so a value rendered as $12.3457K instead of the cleaner $12.35K.

Changes

All four current compact-notation call sites (trending-card.tsx, token-card.tsx, hero-ticker.tsx, ranking-table.tsx) share this
formatter, so the fix lives in formatNumber itself rather than being patched per call site -- applies to all of them at once, and
any future one. An explicit maximumFractionDigits in the caller's options still wins, since it's spread last.

Verification

  • Ran the existing 41-test suite for this file -- all pass, nothing regressed.
  • Added 2 new tests covering the new default and the explicit-override case, verified their expected values against the real function output rather than hand-calculation.
  • Typecheck and lint clean.

Non-blocking follow-up from review on the market cap overflow fix.

formatNumber's default maximumFractionDigits: 4 was carrying into
compact notation too, so a value rendered as $12.3457K instead of the
cleaner $12.35K. All four current compact-notation call sites
(trending-card.tsx, token-card.tsx, hero-ticker.tsx,
ranking-table.tsx) share this, so the fix lives in the shared
formatNumber function itself rather than being patched per call site
-- applies to all of them at once, and any future one.

An explicit maximumFractionDigits in the caller's options still wins,
since it's spread last.

Verified: ran the existing 41-test suite for this file, all pass
(nothing regressed). Added 2 new tests covering the new default and
the explicit-override case, verified their expected values against
the real function output rather than hand-calculation. Typecheck and
lint clean.
@vercel

vercel Bot commented Aug 10, 2026

Copy link
Copy Markdown

@draevik is attempting to deploy a commit to the Lightchain AI Team on Vercel.

A member of the Team first needs to authorize it.

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