Remove comparing a string and a number

Comparing [:155] a string [:154] (from string literal "" [:154] ) and a number [:155] (from number literal 85 [:155] ) might behave differently than you expect, as implicit conversion is performed. Replace `''` with `0` because we use it to display number near the percent sign.
This commit is contained in:
matvii
2020-10-02 17:59:56 +03:00
committed by GitHub
parent e056a634bf
commit 03c2b8cebc
+1 -1
View File
@@ -151,7 +151,7 @@ function percent(node: Node, used: number | string | null, resource: ResourceTyp
const result = unparser(used);
const available = getNodeResourcesAvailable(node, resource);
const displayPercent = available ? _.round(Number(used) / available * 100, 1) : '';
const displayPercent = available ? _.round(Number(used) / available * 100, 1) : 0;
const className = displayPercent >= 85 ? 'contentPanel_warn' : undefined;
return (