fix(table): Double percenting ad-hoc percentage metrics (#25857)

This commit is contained in:
John Bodley 2023-11-08 12:22:00 -08:00 committed by GitHub
parent 458be8c848
commit 784a478268
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 3 deletions

View File

@ -118,9 +118,10 @@ const processColumns = memoizeOne(function processColumns(
// because users can also add things like `MAX(str_col)` as a metric.
const isMetric = metricsSet.has(key) && isNumeric(key, records);
const isPercentMetric = percentMetricsSet.has(key);
const label = isPercentMetric
? `%${verboseMap?.[key.replace('%', '')] || key}`
: verboseMap?.[key] || key;
const label =
isPercentMetric && verboseMap?.hasOwnProperty(key.replace('%', ''))
? `%${verboseMap[key.replace('%', '')]}`
: verboseMap?.[key] || key;
const isTime = dataType === GenericDataType.TEMPORAL;
const isNumber = dataType === GenericDataType.NUMERIC;
const savedFormat = columnFormats?.[key];