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

report(treemap): correct percentages when 0 bytes JS #13382

Merged
merged 1 commit into from
Nov 16, 2021
Merged

Conversation

brendankenny
Copy link
Member

@brendankenny brendankenny commented Nov 16, 2021

when there were 0 total bytes JS on a page, treemap will take percentages of that 0 and happily show you

https://example.com/ · Resource Bytes: 0 B (NaN%)

We saw it on example.com, but also noticed by at least one user.

The "correct" percentage is arguable but since there's just the one entry on the page 100% seemed more reasonable than 0%, since that just leaves you wondering where the rest of the 0 bytes are :)

Testing is awkward. I could change debug.json to include a subnode with 0 total but it seems fiddly (would the test have to click into the subtree to trigger this path?). Add a new pptr test just for this?

fixes #13383

@brendankenny brendankenny requested a review from a team as a code owner November 16, 2021 17:53
@brendankenny brendankenny requested review from connorjclark and removed request for a team November 16, 2021 17:53
@google-cla google-cla bot added the cla: yes label Nov 16, 2021
Copy link
Collaborator

@connorjclark connorjclark left a comment

Choose a reason for hiding this comment

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

Am fine with no tests, but if that makes you queezy it'd be best to make unit tests for makeCaption rather than an integration test.

@brendankenny
Copy link
Member Author

Am fine with no tests, but if that makes you queezy it'd be best to make unit tests for makeCaption rather than an integration test.

yeah, it's fine. A possible regression here isn't fatal or that confusing (NaN is arguably a correct percentage too :), and probably best for someone else to think about ways to increase test coverage for treemap

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Fix NaN in treemap viewer
3 participants