From 35a5fd9c9af73d9886fb70dc1f9fe840fc97d2ec Mon Sep 17 00:00:00 2001 From: Daniel Marsh-Patrick Date: Wed, 17 Apr 2024 14:54:40 +1200 Subject: [PATCH] fix: numeric test error when evaluating tooltip fields (#429) --- src/features/interactivity/tooltip.ts | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/features/interactivity/tooltip.ts b/src/features/interactivity/tooltip.ts index eb2148c2..4e3e8a3f 100644 --- a/src/features/interactivity/tooltip.ts +++ b/src/features/interactivity/tooltip.ts @@ -97,9 +97,11 @@ const getDeepRedactedTooltipItem = (object: object) => { */ const getFieldsEligibleForAutoFormat = (tooltip: object) => pickBy(tooltip, (v, k) => { - const ttKeys = keys(tooltip), - mdKeys = keys(getDatasetFieldsBySelectionKeys(ttKeys)); - return indexOf(mdKeys, k) > -1 && toNumber(tooltip[k]); + const ttKeys = keys(tooltip); + const fields = getDatasetFieldsBySelectionKeys(ttKeys); + const mdKeys = keys(fields); + const isNumeric = fields[k]?.type?.numeric || false; + return indexOf(mdKeys, k) > -1 && isNumeric; }); /**