From e6d963562f187cd73d1606ee378e38726ae4c8be Mon Sep 17 00:00:00 2001 From: Andrew Baldwin Date: Mon, 26 Aug 2024 10:17:42 -0400 Subject: [PATCH] Safeguard charts.time --- locust/webui/src/components/LineChart/LineChart.utils.ts | 2 +- locust/webui/src/redux/slice/ui.slice.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/locust/webui/src/components/LineChart/LineChart.utils.ts b/locust/webui/src/components/LineChart/LineChart.utils.ts index 5a7741c3ae..f63a6a77ba 100644 --- a/locust/webui/src/components/LineChart/LineChart.utils.ts +++ b/locust/webui/src/components/LineChart/LineChart.utils.ts @@ -125,7 +125,7 @@ export const createOptions = >({ }, xAxis: { type: 'time', - startValue: charts.time[0], + startValue: (charts.time || [''])[0], axisLabel: { formatter: formatTimeAxis, }, diff --git a/locust/webui/src/redux/slice/ui.slice.ts b/locust/webui/src/redux/slice/ui.slice.ts index c85c1d60f6..9dc592514d 100644 --- a/locust/webui/src/redux/slice/ui.slice.ts +++ b/locust/webui/src/redux/slice/ui.slice.ts @@ -76,7 +76,7 @@ const uiSlice = createSlice({ ...addSpaceToChartsBetweenTests(state.charts as ICharts), markers: (state.charts as ICharts).markers ? [...((state.charts as ICharts).markers as string[]), payload] - : [state.charts.time[0], payload], + : [(state.charts.time || [''])[0], payload], }, }; },