Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(FormattedBytes): show 1_000 with another unit #1901

Merged
merged 3 commits into from
Feb 4, 2025

Conversation

artemmufazalov
Copy link
Member

@artemmufazalov artemmufazalov commented Feb 3, 2025

Closes #1455

Before:
Screenshot 2025-02-03 at 14 18 13

After:
Screenshot 2025-02-03 at 14 18 32

CI Results

Test Status: βœ… PASSED

πŸ“Š Full Report

Total Passed Failed Flaky Skipped
262 262 0 0 0

😟 No changes in tests. πŸ˜•

Bundle Size: βœ…

Current: 80.19 MB | Main: 80.20 MB
Diff: 2.37 KB (-0.00%)

βœ… Bundle size unchanged.

ℹ️ CI Information
  • Test recordings for failed tests are available in the full report.
  • Bundle size is measured for the entire 'dist' directory.
  • πŸ“Š indicates links to detailed reports.
  • πŸ”Ί indicates increase, πŸ”½ decrease, and βœ… no change in bundle size.

@@ -11,5 +11,5 @@ export const toFormattedSize = (
return null;
}

return <FormattedBytes value={value} significantDigits={2} {...params} />;
return <FormattedBytes value={value} {...params} />;
Copy link
Contributor

Choose a reason for hiding this comment

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

It seems we don't use significantDigits param any more. What do you think about remove it completely? It seems it will simplify logic for formatting values a lot.

Comment on lines +26 to +27
const result1 = formatNumericValues(10, 20);
expect(result1).toEqual(['10', `20`]);
Copy link
Member Author

Choose a reason for hiding this comment

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

Before in such case formatNumericValues returned ['0', '0']

let size: Digits = 'thousand';

if (value > thousandLevel) {
export const getNumberSizeUnit = (value: number) => {
Copy link
Contributor

Choose a reason for hiding this comment

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

May we use http://numeraljs.com/ instead of custom unit getter?

Copy link
Member Author

Choose a reason for hiding this comment

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

We use custom getter, because together with auto formatting we can pass specific unit - it's helpful for data inside tables (data on every row should be with the same unit). AFAIK numeral cannot do formatting to specific units. While formatNumber is not widely used, formatBytes with the same approach is used in most of the tables

@artemmufazalov artemmufazalov added this pull request to the merge queue Feb 4, 2025
Merged via the queue into main with commit 0e8bdd8 Feb 4, 2025
7 checks passed
@artemmufazalov artemmufazalov deleted the 1455-tables-size branch February 4, 2025 10:04
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.

Hard to compare table's data size
2 participants