Variables: Fixes Unsupported data format error for null values (#32480) (#32487)

(cherry picked from commit 009df4fb7a)

Co-authored-by: Hugo Häggmark <hugo.haggmark@grafana.com>
This commit is contained in:
Grot (@grafanabot)
2021-03-31 06:08:49 +02:00
committed by GitHub
co-authored by Hugo Häggmark
parent e60f34336e
commit c270520aa9
2 changed files with 7 additions and 1 deletions
@@ -290,6 +290,8 @@ describe('areMetricFindValues', () => {
${[{ text: { foo: 1 } }]} | ${false}
${[{ text: Symbol('foo') }]} | ${false}
${[{ text: true }]} | ${false}
${[{ text: null }]} | ${true}
${[{ value: null }]} | ${true}
${[]} | ${true}
${[{ text: '' }]} | ${true}
${[{ Text: '' }]} | ${true}
@@ -193,7 +193,11 @@ export function areMetricFindValues(data: any[]): data is MetricFindValue[] {
continue;
}
if (typeof firstValue[firstValueKey] !== 'string' && typeof firstValue[firstValueKey] !== 'number') {
if (
firstValue[firstValueKey] !== null &&
typeof firstValue[firstValueKey] !== 'string' &&
typeof firstValue[firstValueKey] !== 'number'
) {
continue;
}