-
Notifications
You must be signed in to change notification settings - Fork 73
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: use ||
operator instead of unreachable ??
#2845
Conversation
Your org requires the Graphite merge queue for merging into mainAdd the label “flow:merge-queue” to the PR and Graphite will automatically add it to the merge queue when it’s ready to merge. Or use the label “flow:hotfix” to add to the merge queue as a hot fix. You must have a Graphite account and log in to Graphite in order to use the merge queue. Sign up using this link. |
Coverage report for
|
St.❔ |
Category | Percentage | Covered / Total |
---|---|---|---|
🔴 | Statements | 5.29% | 395/7462 |
🔴 | Branches | 4.59% (-0% 🔻) |
237/5166 |
🔴 | Functions | 3.16% | 78/2466 |
🔴 | Lines | 5.21% | 380/7295 |
Test suite run success
124 tests passing in 14 suites.
Report generated by 🧪jest coverage report action from ae54e8a
((iSizeToSize(_.toString(agent?.mem_cur_bytes), 'g') | ||
?.number ?? 0) / | ||
(iSizeToSize(parsedAvailableSlots?.mem, 'g')?.number ?? | ||
?.number || 0) / | ||
(iSizeToSize(parsedAvailableSlots?.mem, 'g')?.number || | ||
0)) * | ||
100 ?? 0 | ||
100 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
((iSizeToSize(_.toString(agent?.mem_cur_bytes), 'g') | |
?.number ?? 0) / | |
(iSizeToSize(parsedAvailableSlots?.mem, 'g')?.number ?? | |
?.number || 0) / | |
(iSizeToSize(parsedAvailableSlots?.mem, 'g')?.number || | |
0)) * | |
100 ?? 0 | |
100 | |
(_.toNumber( | |
iSizeToSize(_.toString(agent?.mem_cur_bytes), 'g') | |
?.number, | |
) / | |
_.toNumber( | |
iSizeToSize(parsedAvailableSlots?.mem, 'g')?.number, | |
)) * | |
100 || 0 |
To further improve, instead of using || 0
to handle NaN, we can modify BAIProgressWithLabel
to display the percent as disabled or distinguish it in some way when it is NaN.
e1dfd19
to
381e3ed
Compare
381e3ed
to
edd4992
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I pushed a commit to fix condition. Please check it. Now, LGTM! 💪 🙏
Merge activity
|
Fix `Right operand of ?? is unreachable because the left operand is never nullish.` error by using `||` operator. **Checklist:** (if applicable) - [ ] Mention to the original issue - [ ] Documentation - [ ] Minium required manager version - [ ] Specific setting for review (eg., KB link, endpoint or how to setup) - [ ] Minimum requirements to check during review - [ ] Test case(s) to demonstrate the difference of before/after
e73e169
to
ae54e8a
Compare
Fix
Right operand of ?? is unreachable because the left operand is never nullish.
error by using||
operator.Checklist: (if applicable)