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

This commit is contained in:
Hugo Häggmark 2021-03-30 12:31:48 +02:00 committed by GitHub
parent f0d6f132ae
commit 009df4fb7a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 1 deletions

View File

@ -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}

View File

@ -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;
}