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