Repository navigation
fix: move long numbers to the next unit when they round up - #4658
Merged
mikecao merged 1 commit intoOct 22, 2026
Merged
Conversation
|
@Enesuygurs is attempting to deploy a commit to the Umami Software Team on Vercel. A member of the Team first needs to authorize it. |
Contributor
[Medium impact] The PR appears safe to merge. Summary
No actionable issues found. Tests were inspected, not run. Reviews (1) · Last reviewed commit: "fix: move long numbers to the next unit ..." · Reviewed by Greptile |
mikecao
approved these changes
Oct 22, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
formatLongNumber(src/lib/format.ts) picks the unit from the raw value and then rounds withtoFixed, so values just below a unit boundary round up to an impossible label:999999→1000k(should be1.0m)999999999→1000.0m(should be1.0b)99999→100.0k(should be100k)9999→10.00k(should be10.0k)999.6→1000(should be1.00k)formatLongNumberis used in the link and pixel metrics bars and in the attribution, funnel, goal, heatmap and journey reports, so the wrong labels show up in all of them.Fix
Lower each threshold by half of the smaller format's last digit (
999950000,999500,99950,9995,999.5). A value that would round up to the next boundary now uses the next format instead. Values outside these small ranges format exactly as before.Tests
Added a
formatLongNumbertest insrc/lib/format.test.tsthat covers the value just above and just below each new threshold.expected '1000.0m' to be '1.0b'.npx vitest run src/lib/format.test.tspasses all 9 tests.biome lintis clean on both changed files.Need help on this PR? Tag
@codesmith-botwith what you need.