diff --git a/public/pages/utils/anomalyResultUtils.ts b/public/pages/utils/anomalyResultUtils.ts index 160afbb0..acb0b955 100644 --- a/public/pages/utils/anomalyResultUtils.ts +++ b/public/pages/utils/anomalyResultUtils.ts @@ -1767,10 +1767,17 @@ export const convertToCategoryFieldAndEntityString = ( if (index > 0) { entityString += delimiter; } + + // It is possible that entity.name is undefined when we artificially add + // whitespace strings as the entity values when the heatmap is empty (see + // getSampleAnomaliesHeatmapData()) + // If true, set the entire string as 'None' entityString += - entity.name + - `${HEATMAP_CALL_ENTITY_KEY_VALUE_DELIMITER}` + - entity.value; + entity.name !== undefined + ? entity.name + + `${HEATMAP_CALL_ENTITY_KEY_VALUE_DELIMITER}` + + entity.value + : 'None'; }); } return entityString;