fix: new widget condition is fixed and handling of undefined is done (#2906)

This commit is contained in:
Palash Gupta 2023-06-15 14:13:58 +05:30 committed by GitHub
parent 389385324f
commit 3792f137fa
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 10 deletions

View File

@ -83,14 +83,14 @@ function GridCardGraph({
const queryResponse = useGetQueryRange(
{
selectedTime: widget?.timePreferance,
graphType: widget.panelTypes,
query: widget.query,
graphType: widget?.panelTypes,
query: widget?.query,
globalSelectedInterval,
variables: getDashboardVariables(),
},
{
queryKey: [
`GetMetricsQueryRange-${widget?.timePreferance}-${globalSelectedInterval}-${widget.id}`,
`GetMetricsQueryRange-${widget?.timePreferance}-${globalSelectedInterval}-${widget?.id}`,
widget,
maxTime,
minTime,
@ -173,7 +173,7 @@ function GridCardGraph({
{
data: selectedDashboard.data,
generateWidgetId: uuid,
graphType: widget.panelTypes,
graphType: widget?.panelTypes,
selectedDashboard,
layout,
widgetData: widget,
@ -187,7 +187,7 @@ function GridCardGraph({
setTimeout(() => {
history.push(
`${history.location.pathname}/new?graphType=${widget.panelTypes}&widgetId=${uuid}`,
`${history.location.pathname}/new?graphType=${widget?.panelTypes}&widgetId=${uuid}`,
);
}, 1500);
});
@ -253,10 +253,10 @@ function GridCardGraph({
/>
</div>
<GridGraphComponent
GRAPH_TYPES={widget.panelTypes}
GRAPH_TYPES={widget?.panelTypes}
data={prevChartDataSetRef}
isStacked={widget.isStacked}
opacity={widget.opacity}
isStacked={widget?.isStacked}
opacity={widget?.opacity}
title={' '}
name={name}
yAxisUnit={yAxisUnit}

View File

@ -124,8 +124,7 @@ function GridGraph(props: Props): JSX.Element {
}
}
})();
// eslint-disable-next-line react-hooks/exhaustive-deps
}, []);
}, [dispatch, isAddWidget, layouts, selectedDashboard, widgets]);
const { featureResponse } = useSelector<AppState, AppReducer>(
(state) => state.app,