diff --git a/packages/grafana-data/src/field/fieldOverrides.ts b/packages/grafana-data/src/field/fieldOverrides.ts index 936f4c6d5e7..0924a417231 100644 --- a/packages/grafana-data/src/field/fieldOverrides.ts +++ b/packages/grafana-data/src/field/fieldOverrides.ts @@ -350,7 +350,7 @@ export function setFieldConfigDefaults(config: FieldConfig, defaults: FieldConfi // if we have a base threshold set by default but not on the config, we need to merge it in const defaultBaseStep = - defaults.thresholds?.mode === ThresholdsMode.Absolute && + defaults?.thresholds?.mode === ThresholdsMode.Absolute && defaults.thresholds?.steps.find((step) => step.value === -Infinity); if ( config.thresholds?.mode === ThresholdsMode.Absolute && diff --git a/public/app/features/transformers/configFromQuery/configFromQuery.test.ts b/public/app/features/transformers/configFromQuery/configFromQuery.test.ts index dbf6e024eb2..4dc249fc19d 100644 --- a/public/app/features/transformers/configFromQuery/configFromQuery.test.ts +++ b/public/app/features/transformers/configFromQuery/configFromQuery.test.ts @@ -93,7 +93,7 @@ describe('config from data', () => { const results = extractConfigFromQuery(options, [config, seriesA]); expect(results.length).toBe(1); - const thresholdConfig = results[0].fields[1].config.thresholds?.steps[1]; + const thresholdConfig = results[0].fields[1].config.thresholds?.steps[0]; expect(thresholdConfig).toBeDefined(); expect(thresholdConfig?.color).toBe('orange'); expect(thresholdConfig?.value).toBe(50); diff --git a/public/app/features/transformers/rowsToFields/rowsToFields.test.ts b/public/app/features/transformers/rowsToFields/rowsToFields.test.ts index 333fa1ae093..f6e458db2b8 100644 --- a/public/app/features/transformers/rowsToFields/rowsToFields.test.ts +++ b/public/app/features/transformers/rowsToFields/rowsToFields.test.ts @@ -111,7 +111,7 @@ describe('Rows to fields', () => { }); const result = rowsToFields({}, input); - expect(result.fields[0].config.thresholds?.steps[1].value).toBe(30); + expect(result.fields[0].config.thresholds?.steps[0].value).toBe(30); }); it('Will extract other string fields to labels', () => {