diff --git a/x-pack/plugins/infra/public/alerting/metric_threshold/components/expression_chart.test.tsx b/x-pack/plugins/infra/public/alerting/metric_threshold/components/expression_chart.test.tsx index d9db49192d5c4..be22d90cc2729 100644 --- a/x-pack/plugins/infra/public/alerting/metric_threshold/components/expression_chart.test.tsx +++ b/x-pack/plugins/infra/public/alerting/metric_threshold/components/expression_chart.test.tsx @@ -34,7 +34,7 @@ const mockResponse = { }; jest.mock('../hooks/use_metrics_explorer_chart_data', () => ({ - useMetricsExplorerChartData: () => ({ loading: false, data: mockResponse }), + useMetricsExplorerChartData: () => ({ loading: false, data: { pages: [mockResponse] } }), })); describe('ExpressionChart', () => { diff --git a/x-pack/plugins/infra/public/alerting/metric_threshold/components/expression_chart.tsx b/x-pack/plugins/infra/public/alerting/metric_threshold/components/expression_chart.tsx index fa71e9f99af51..19503c37a2f05 100644 --- a/x-pack/plugins/infra/public/alerting/metric_threshold/components/expression_chart.tsx +++ b/x-pack/plugins/infra/public/alerting/metric_threshold/components/expression_chart.tsx @@ -71,7 +71,7 @@ export const ExpressionChart: React.FC = ({ } const isDarkMode = uiSettings?.get('theme:darkMode') || false; - const firstSeries = first(first(data.pages)!.series)!; + const firstSeries = first(first(data.pages)!.series); // Creating a custom series where the ID is changed to 0 // so that we can get a proper domain if (!firstSeries || !firstSeries.rows || firstSeries.rows.length === 0) {