mirror of
https://git.mirrors.martin98.com/https://github.com/SigNoz/signoz
synced 2025-08-15 05:25:58 +08:00
fix: Chart is not updating on change of variables (#2020)
* fix: Chart is not updating onchange of variables * fix: Added useLocation hook for pathname * fix: Lint issues resolved * fix: Updated logic behind change of variables * fix: Suggested changes of variable Co-authored-by: Palash Gupta <palashgdev@gmail.com>
This commit is contained in:
parent
e62e541fc4
commit
6cc7025e37
@ -21,6 +21,7 @@ import { GlobalTime } from 'types/actions/globalTime';
|
||||
import { ErrorResponse, SuccessResponse } from 'types/api';
|
||||
import { Widgets } from 'types/api/dashboard/getAll';
|
||||
import { MetricRangePayloadProps } from 'types/api/metrics/getQueryRange';
|
||||
import DashboardReducer from 'types/reducer/dashboards';
|
||||
import { GlobalReducer } from 'types/reducer/globalTime';
|
||||
|
||||
import { LayoutProps } from '..';
|
||||
@ -49,13 +50,25 @@ function GridCardGraph({
|
||||
AppState,
|
||||
GlobalReducer
|
||||
>((state) => state.globalTime);
|
||||
const { dashboards } = useSelector<AppState, DashboardReducer>(
|
||||
(state) => state.dashboards,
|
||||
);
|
||||
const [selectedDashboard] = dashboards;
|
||||
const selectedData = selectedDashboard?.data;
|
||||
const { variables } = selectedData;
|
||||
|
||||
const response = useQuery<
|
||||
SuccessResponse<MetricRangePayloadProps> | ErrorResponse
|
||||
>(
|
||||
[
|
||||
`GetMetricsQueryRange-${widget.timePreferance}-${globalSelectedInterval}-${widget.id}`,
|
||||
{ widget, maxTime, minTime, globalSelectedInterval },
|
||||
{
|
||||
widget,
|
||||
maxTime,
|
||||
minTime,
|
||||
globalSelectedInterval,
|
||||
variables,
|
||||
},
|
||||
],
|
||||
() =>
|
||||
GetMetricQueryRange({
|
||||
|
Loading…
x
Reference in New Issue
Block a user