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(web): byte units enum #11161

Merged
merged 1 commit into from
Jul 17, 2024
Merged

fix(web): byte units enum #11161

merged 1 commit into from
Jul 17, 2024

Conversation

michelheusschen
Copy link
Contributor

Returning the byte unit as a numeric enum in getBytesWithUnit is error-prone:

  1. Manual mapping to a string can be forgotten
  2. ByteUnit.B is zero and thus falsy, causing issues with if (unit) checks

Switching to a string enum solves these problems. This also fixes an issue I saw on discord for small viewports (the 3 should be GiB):

image

Copy link
Member

@danieldietzler danieldietzler left a comment

Choose a reason for hiding this comment

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

Nice, thank you!

@jrasm91 jrasm91 merged commit e3fd766 into main Jul 17, 2024
22 checks passed
@jrasm91 jrasm91 deleted the fix/web-byte-units branch July 17, 2024 11:25
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.

3 participants