fix: add safety checks to handle null response from query range API (#4939)

This commit is contained in:
Yunus M 2024-05-01 15:49:30 +05:30 committed by GitHub
parent 64bf580323
commit e78e1d4b63
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 2 additions and 2 deletions

View File

@ -59,7 +59,7 @@ function WidgetGraphComponent({
const lineChartRef = useRef<ToggleGraphProps>(); const lineChartRef = useRef<ToggleGraphProps>();
const [graphVisibility, setGraphVisibility] = useState<boolean[]>( const [graphVisibility, setGraphVisibility] = useState<boolean[]>(
Array(queryResponse.data?.payload?.data.result.length || 0).fill(true), Array(queryResponse.data?.payload?.data?.result?.length || 0).fill(true),
); );
const graphRef = useRef<HTMLDivElement>(null); const graphRef = useRef<HTMLDivElement>(null);

View File

@ -100,7 +100,7 @@ export const getUPlotChartOptions = ({
y: { y: {
...getYAxisScale({ ...getYAxisScale({
thresholds, thresholds,
series: apiResponse?.data.newResult.data.result, series: apiResponse?.data?.newResult?.data?.result || [],
yAxisUnit, yAxisUnit,
softMax, softMax,
softMin, softMin,