SigNoz is an open-source, OpenTelemetry-native observability platform for your team and their AI agents. Get logs, metrics, and traces in one tool with features like APM, distributed tracing, log management, infra monitoring, etc. Combined with SigNoz MCP and a native AI teammate (in SigNoz Cloud) it helps you build more resilient apps.
TypeScript apmapplication-monitoringdistributed-tracinggogood-first-issuejaegerloglogsmetricsmonitoringnextjsobservabilityopen-sourceopentelemetryprometheusreactreactjsself-hostedtracingtypescript
chore: update variables store with derived values (#10194)
Ashwin Bhatkalf7728c901965
diff --git a/frontend/src/container/DashboardContainer/DashboardSettings/DashboardVariableSettings/index.tsx b/frontend/src/container/DashboardContainer/DashboardSettings/DashboardVariableSettings/index.tsxindex a8cb4e661c..baf94a786e 100644--- a/frontend/src/container/DashboardContainer/DashboardSettings/DashboardVariableSettings/index.tsx+++ b/frontend/src/container/DashboardContainer/DashboardSettings/DashboardVariableSettings/index.tsx@@ -22,7 +22,7 @@ import { useUpdateDashboard } from 'hooks/dashboard/useUpdateDashboard';import { useNotifications } from 'hooks/useNotifications';import { PenLine, Trash2 } from 'lucide-react';import { useDashboard } from 'providers/Dashboard/Dashboard';-import { IDashboardVariables } from 'providers/Dashboard/store/dashboardVariablesStore';+import { IDashboardVariables } from 'providers/Dashboard/store/dashboardVariables/dashboardVariablesStoreTypes';import { IDashboardVariable } from 'types/api/dashboard/getAll';import { TVariableMode } from './types';diff --git a/frontend/src/container/DashboardContainer/DashboardVariablesSelection/DashboardVariableSelection.tsx b/frontend/src/container/DashboardContainer/DashboardVariablesSelection/DashboardVariableSelection.tsxindex 8135d1bd33..e023a283b9 100644--- a/frontend/src/container/DashboardContainer/DashboardVariablesSelection/DashboardVariableSelection.tsx+++ b/frontend/src/container/DashboardContainer/DashboardVariablesSelection/DashboardVariableSelection.tsx@@ -1,8 +1,11 @@-import { memo, useEffect, useState } from 'react';+import { memo, useEffect } from 'react';import { useSelector } from 'react-redux';import { Row } from 'antd';import { ALL_SELECTED_VALUE } from 'components/NewSelect/utils';-import { useDashboardVariables } from 'hooks/dashboard/useDashboardVariables';+import {+ useDashboardVariables,+ useDashboardVariablesSelector,+} from 'hooks/dashboard/useDashboardVariables';import useVariablesFromUrl from 'hooks/dashboard/useVariablesFromUrl';import { isEmpty } from 'lodash-es';import { useDashboard } from 'providers/Dashboard/Dashboard';@@ -12,13 +15,7 @@ import { IDashboardVariable } from 'types/api/dashboard/getAll';import { GlobalReducer } from 'types/reducer/globalTime';import DynamicVariableSelection from './DynamicVariableSelection';-import {- buildDependencies,- buildDependencyGraph,- buildParentDependencyGraph,- IDependencyData,- onUpdateVariableNode,-} from './util';+import { onUpdateVariableNode } from './util';import VariableItem from './VariableItem';import './DashboardVariableSelection.styles.scss';@@ -35,11 +32,11 @@ function DashboardVariableSelection(): JSX.Element | null {const { updateUrlVariable, getUrlVariables } = useVariablesFromUrl();const { dashboardVariables } = useDashboardVariables();-- const [variablesTableData, setVariablesTableData] = useState<any>([]);-- const [dependencyData, setDependencyData] = useState<IDependencyData | null>(- null,+ const sortedVariablesArray = useDashboardVariablesSelector(+ (state) => state.sortedVariablesArray,+ );+ const dependencyData = useDashboardVariablesSelector(+ (state) => state.dependencyData,);const { maxTime, minTime } = useSelector<AppState, GlobalReducer>(@@ -47,24 +44,6 @@ function DashboardVariableSelection(): JSX.Element | null {);useEffect(() => {- const tableRowData = [];-- // eslint-disable-next-line no-restricted-syntax- for (const [key, value] of Object.entries(dashboardVariables)) {- const { id } = value;-- tableRowData.push({- key,- name: key,- ...dashboardVariables[key],- id,- });- }-- tableRowData.sort((a, b) => a.order - b.order);-- setVariablesTableData(tableRowData);-// Initialize variables with default values if not in URLinitializeDefaultVariables(dashboardVariables,@@ -73,30 +52,6 @@ function DashboardVariableSelection(): JSX.Element | null {);}, [getUrlVariables, updateUrlVariable, dashboardVariables]);- useEffect(() => {- if (variablesTableData.length > 0) {- const depGrp = buildDependencies(variablesTableData);- const { order, graph, hasCycle, cycleNodes } = buildDependencyGraph(depGrp);- const parentDependencyGraph = buildParentDependencyGraph(graph);-- // cleanup order to only include variables that are of type 'QUERY'- const cleanedOrder = order.filter((variable) => {- const variableData = variablesTableData.find(- (v: IDashboardVariable) => v.name === variable,- );- return variableData?.type === 'QUERY';- });-- setDependencyData({- order: cleanedOrder,- graph,- parentDependencyGraph,- hasCycle,- cycleNodes,- });- }- }, [dashboardVariables, variablesTableData]);-// this handles the case where the dependency order changes i.e. variable list updated via creation or deletion etc. and we need to refetch the variables// also trigger when the global time changesuseEffect(@@ -186,45 +141,30 @@ function DashboardVariableSelection(): JSX.Element | null {}};- if (!dashboardVariables) {- return null;- }-- const orderBasedSortedVariables = variablesTableData.sort(- (a: { order: number }, b: { order: number }) => a.order - b.order,- );-return (<Row style={{ display: 'flex', gap: '12px' }}>- {orderBasedSortedVariables &&- Array.isArray(orderBasedSortedVariables) &&- orderBasedSortedVariables.length > 0 &&- orderBasedSortedVariables.map((variable) =>- variable.type === 'DYNAMIC' ? (- <DynamicVariableSelection- key={`${variable.name}${variable.id}${variable.order}`}- existingVariables={dashboardVariables}- variableData={{- name: variable.name,- ...variable,- }}- onValueUpdate={onValueUpdate}- />- ) : (- <VariableItem- key={`${variable.name}${variable.id}}${variable.order}`}- existingVariables={dashboardVariables}- variableData={{- name: variable.name,- ...variable,- }}- onValueUpdate={onValueUpdate}- variablesToGetUpdated={variablesToGetUpdated}- setVariablesToGetUpdated={setVariablesToGetUpdated}- dependencyData={dependencyData}- />- ),- )}+ {sortedVariablesArray.map((variable) => {+ const key = `${variable.name}${variable.id}${variable.order}`;++ return variable.type === 'DYNAMIC' ? (+ <DynamicVariableSelection+ key={key}+ existingVariables={dashboardVariables}+ variableData={variable}+ onValueUpdate={onValueUpdate}+ />+ ) : (+ <VariableItem+ key={key}+ existingVariables={dashboardVariables}+ variableData={variable}+ onValueUpdate={onValueUpdate}+ variablesToGetUpdated={variablesToGetUpdated}+ setVariablesToGetUpdated={setVariablesToGetUpdated}+ dependencyData={dependencyData}+ />+ );+ })}</Row>);}diff --git a/frontend/src/container/DashboardContainer/DashboardVariablesSelection/VariableItem.tsx b/frontend/src/container/DashboardContainer/DashboardVariablesSelection/VariableItem.tsxindex bcccb33f73..40899af64e 100644--- a/frontend/src/container/DashboardContainer/DashboardVariablesSelection/VariableItem.tsx+++ b/frontend/src/container/DashboardContainer/DashboardVariablesSelection/VariableItem.tsx@@ -16,6 +16,7 @@ import { REACT_QUERY_KEY } from 'constants/reactQueryKeys';import { commaValuesParser } from 'lib/dashbaordVariables/customCommaValuesParser';import sortValues from 'lib/dashbaordVariables/sortVariableValues';import { debounce, isArray, isEmpty, isString } from 'lodash-es';+import { IDependencyData } from 'providers/Dashboard/store/dashboardVariables/dashboardVariablesStoreTypes';import { AppState } from 'store/reducers';import { IDashboardVariable } from 'types/api/dashboard/getAll';import { VariableResponseProps } from 'types/api/dashboard/variables/query';@@ -24,7 +25,7 @@ import { popupContainer } from 'utils/selectPopupContainer';import { ALL_SELECT_VALUE, variablePropsToPayloadVariables } from '../utils';import { SelectItemStyle } from './styles';-import { areArraysEqual, checkAPIInvocation, IDependencyData } from './util';+import { areArraysEqual, checkAPIInvocation } from './util';import './DashboardVariableSelection.styles.scss';diff --git a/frontend/src/container/DashboardContainer/DashboardVariablesSelection/useDashboardVariableUpdate.ts b/frontend/src/container/DashboardContainer/DashboardVariablesSelection/useDashboardVariableUpdate.tsindex 131b4183f8..6c200ea2f7 100644--- a/frontend/src/container/DashboardContainer/DashboardVariablesSelection/useDashboardVariableUpdate.ts+++ b/frontend/src/container/DashboardContainer/DashboardVariablesSelection/useDashboardVariableUpdate.ts@@ -3,7 +3,7 @@ import { useCallback } from 'react';import { useAddDynamicVariableToPanels } from 'hooks/dashboard/useAddDynamicVariableToPanels';import { useUpdateDashboard } from 'hooks/dashboard/useUpdateDashboard';import { useDashboard } from 'providers/Dashboard/Dashboard';-import { IDashboardVariables } from 'providers/Dashboard/store/dashboardVariablesStore';+import { IDashboardVariables } from 'providers/Dashboard/store/dashboardVariables/dashboardVariablesStoreTypes';import { IDashboardVariable } from 'types/api/dashboard/getAll';import { v4 as uuidv4 } from 'uuid';diff --git a/frontend/src/container/DashboardContainer/DashboardVariablesSelection/util.ts b/frontend/src/container/DashboardContainer/DashboardVariablesSelection/util.tsindex 8e6767d6ee..57d39d5ba0 100644--- a/frontend/src/container/DashboardContainer/DashboardVariablesSelection/util.ts+++ b/frontend/src/container/DashboardContainer/DashboardVariablesSelection/util.ts@@ -1,6 +1,9 @@import { OptionData } from 'components/NewSelect/types';import { isEmpty, isNull } from 'lodash-es';-import { IDashboardVariables } from 'providers/Dashboard/store/dashboardVariablesStore';+import {+ IDashboardVariables,+ IDependencyData,+} from 'providers/Dashboard/store/dashboardVariables/dashboardVariablesStoreTypes';import { IDashboardVariable } from 'types/api/dashboard/getAll';export function areArraysEqual(@@ -97,14 +100,6 @@ export const buildDependencies = (return graph;};-export interface IDependencyData {- order: string[];- graph: VariableGraph;- parentDependencyGraph: VariableGraph;- hasCycle: boolean;- cycleNodes?: string[];-}-export const buildParentDependencyGraph = (graph: VariableGraph,): VariableGraph => {diff --git a/frontend/src/container/GridCardLayout/GridCard/types.ts b/frontend/src/container/GridCardLayout/GridCard/types.tsindex 85fcef854c..b7c3c4c97f 100644--- a/frontend/src/container/GridCardLayout/GridCard/types.ts+++ b/frontend/src/container/GridCardLayout/GridCard/types.ts@@ -4,7 +4,7 @@ import { ToggleGraphProps } from 'components/Graph/types';import { GetQueryResultsProps } from 'lib/dashboard/getQueryResults';import { RowData } from 'lib/query/createTableColumnsFromQuery';import { OnClickPluginOpts } from 'lib/uPlotLib/plugins/onClickPlugin';-import { IDashboardVariables } from 'providers/Dashboard/store/dashboardVariablesStore';+import { IDashboardVariables } from 'providers/Dashboard/store/dashboardVariables/dashboardVariablesStoreTypes';import { SuccessResponse } from 'types/api';import { Widgets } from 'types/api/dashboard/getAll';import { MetricRangePayloadProps } from 'types/api/metrics/getQueryRange';diff --git a/frontend/src/container/QueryBuilder/filters/QueryBuilderSearchV2/__test__/QueryBuilderSearchV2.test.tsx b/frontend/src/container/QueryBuilder/filters/QueryBuilderSearchV2/__test__/QueryBuilderSearchV2.test.tsxindex 34abf69c11..e7c2281876 100644--- a/frontend/src/container/QueryBuilder/filters/QueryBuilderSearchV2/__test__/QueryBuilderSearchV2.test.tsx+++ b/frontend/src/container/QueryBuilder/filters/QueryBuilderSearchV2/__test__/QueryBuilderSearchV2.test.tsx@@ -12,7 +12,7 @@ import {initialQueriesMap,initialQueryBuilderFormValues,} from 'constants/queryBuilder';-import { IUseDashboardVariablesReturn } from 'hooks/dashboard/useDashboardVariables';+import { IUseDashboardVariablesReturn } from 'providers/Dashboard/store/dashboardVariables/dashboardVariablesStoreTypes';import { QueryBuilderContext } from 'providers/QueryBuilder';import { IDashboardVariable } from 'types/api/dashboard/getAll';import { DataTypes } from 'types/api/queryBuilder/queryAutocompleteResponse';diff --git a/frontend/src/hooks/dashboard/__test__/useGetResolvedText.test.tsx b/frontend/src/hooks/dashboard/__test__/useGetResolvedText.test.tsxindex 1081265159..540740c30b 100644--- a/frontend/src/hooks/dashboard/__test__/useGetResolvedText.test.tsx+++ b/frontend/src/hooks/dashboard/__test__/useGetResolvedText.test.tsx@@ -1,6 +1,6 @@import React from 'react';import { renderHook } from '@testing-library/react';-import { IDashboardVariables } from 'providers/Dashboard/store/dashboardVariablesStore';+import { IDashboardVariables } from 'providers/Dashboard/store/dashboardVariables/dashboardVariablesStoreTypes';import useGetResolvedText from '../useGetResolvedText';diff --git a/frontend/src/hooks/dashboard/useDashboardVariables.ts b/frontend/src/hooks/dashboard/useDashboardVariables.tsindex 57055f2fe5..0d880d113f 100644--- a/frontend/src/hooks/dashboard/useDashboardVariables.ts+++ b/frontend/src/hooks/dashboard/useDashboardVariables.ts@@ -1,21 +1,40 @@-import { useSyncExternalStore } from 'react';-+import { useCallback, useRef, useSyncExternalStore } from 'react';+import { dashboardVariablesStore } from 'providers/Dashboard/store/dashboardVariables/dashboardVariablesStore';import {- dashboardVariablesStore,- IDashboardVariables,-} from '../../providers/Dashboard/store/dashboardVariablesStore';+ IDashboardVariablesStoreState,+ IUseDashboardVariablesReturn,+} from 'providers/Dashboard/store/dashboardVariables/dashboardVariablesStoreTypes';-export interface IUseDashboardVariablesReturn {- dashboardVariables: IDashboardVariables;-}+/**+ * Generic selector hook for dashboard variables store+ * Allows granular subscriptions to any part of the store state+ *+ * @example+ * ! Select top-level field+ * const variables = useDashboardVariablesSelector(s => s.variables);+ *+ * ! Select specific variable+ * const fooVar = useDashboardVariablesSelector(s => s.variables['foo']);+ *+ * ! Select derived value+ * const hasVariables = useDashboardVariablesSelector(s => Object.keys(s.variables).length > 0);+ */+export const useDashboardVariablesSelector = <T>(+ selector: (state: IDashboardVariablesStoreState) => T,+): T => {+ const selectorRef = useRef(selector);+ selectorRef.current = selector;-export const useDashboardVariables = (): IUseDashboardVariablesReturn => {- const dashboardVariables = useSyncExternalStore(- dashboardVariablesStore.subscribe,- dashboardVariablesStore.getSnapshot,+ const getSnapshot = useCallback(+ () => selectorRef.current(dashboardVariablesStore.getSnapshot()),+ [],);- return {- dashboardVariables,- };+ return useSyncExternalStore(dashboardVariablesStore.subscribe, getSnapshot);+};++export const useDashboardVariables = (): IUseDashboardVariablesReturn => {+ const dashboardVariables = useDashboardVariablesSelector((s) => s.variables);++ return { dashboardVariables };};diff --git a/frontend/src/lib/dashbaordVariables/getDashboardVariables.ts b/frontend/src/lib/dashbaordVariables/getDashboardVariables.tsindex c2bad4e5ca..e90a92b35b 100644--- a/frontend/src/lib/dashbaordVariables/getDashboardVariables.ts+++ b/frontend/src/lib/dashbaordVariables/getDashboardVariables.ts@@ -1,5 +1,5 @@import getStartEndRangeTime from 'lib/getStartEndRangeTime';-import { IDashboardVariables } from 'providers/Dashboard/store/dashboardVariablesStore';+import { IDashboardVariables } from 'providers/Dashboard/store/dashboardVariables/dashboardVariablesStoreTypes';import store from 'store';export const getDashboardVariables = (diff --git a/frontend/src/providers/Dashboard/Dashboard.tsx b/frontend/src/providers/Dashboard/Dashboard.tsxindex 609e55da57..e8a941c48b 100644--- a/frontend/src/providers/Dashboard/Dashboard.tsx+++ b/frontend/src/providers/Dashboard/Dashboard.tsx@@ -45,8 +45,11 @@ import APIError from 'types/api/error';import { GlobalReducer } from 'types/reducer/globalTime';import { v4 as generateUUID } from 'uuid';-import { useDashboardVariables } from '../../hooks/dashboard/useDashboardVariables';-import { setDashboardVariablesStore } from './store/dashboardVariablesStore';+import { useDashboardVariablesSelector } from '../../hooks/dashboard/useDashboardVariables';+import {+ setDashboardVariablesStore,+ updateDashboardVariablesStore,+} from './store/dashboardVariables/dashboardVariablesStore';import {DashboardSortOrder,IDashboardContext,@@ -198,14 +201,23 @@ export function DashboardProvider({: isDashboardWidgetPage?.params.dashboardId) || '';const [selectedDashboard, setSelectedDashboard] = useState<Dashboard>();- const dashboardVariables = useDashboardVariables();+ const dashboardVariables = useDashboardVariablesSelector((s) => s.variables);+ const savedDashboardId = useDashboardVariablesSelector((s) => s.dashboardId);useEffect(() => {const existingVariables = dashboardVariables;const updatedVariables = selectedDashboard?.data.variables || {};- if (!isEqual(existingVariables, updatedVariables)) {- setDashboardVariablesStore(updatedVariables);+ if (savedDashboardId !== dashboardId) {+ setDashboardVariablesStore({+ dashboardId,+ variables: updatedVariables,+ });+ } else if (!isEqual(existingVariables, updatedVariables)) {+ updateDashboardVariablesStore({+ dashboardId,+ variables: updatedVariables,+ });}}, [selectedDashboard]);diff --git a/frontend/src/providers/Dashboard/store/dashboardVariables/dashboardVariablesStore.ts b/frontend/src/providers/Dashboard/store/dashboardVariables/dashboardVariablesStore.tsnew file mode 100644index 0000000000..a0ccffb57e--- /dev/null+++ b/frontend/src/providers/Dashboard/store/dashboardVariables/dashboardVariablesStore.ts@@ -0,0 +1,57 @@+import createStore from '../store';+import { IDashboardVariablesStoreState } from './dashboardVariablesStoreTypes';+import {+ computeDerivedValues,+ updateDerivedValues,+} from './dashboardVariablesStoreUtils';++const initialState: IDashboardVariablesStoreState = {+ dashboardId: '',+ variables: {},+ sortedVariablesArray: [],+ dependencyData: null,+};++export const dashboardVariablesStore = createStore<IDashboardVariablesStoreState>(+ initialState,+);++/**+ * Set dashboard variables (replaces all variables)+ */+export function setDashboardVariablesStore({+ dashboardId,+ variables,+}: {+ dashboardId: string;+ variables: IDashboardVariablesStoreState['variables'];+}): void {+ dashboardVariablesStore.set(() => {+ return {+ dashboardId,+ variables,+ ...computeDerivedValues(variables),+ } as IDashboardVariablesStoreState;+ });+}++/**+ * Update specific dashboard variables (merges with existing)+ */+export function updateDashboardVariablesStore({+ dashboardId,+ variables,+}: {+ dashboardId: string;+ variables: IDashboardVariablesStoreState['variables'];+}): void {+ dashboardVariablesStore.update((draft) => {+ if (draft.dashboardId !== dashboardId) {+ // If dashboardId doesn't match, we replace the entire state+ draft.dashboardId = dashboardId;+ }+ draft.variables = variables;++ updateDerivedValues(draft);+ });+}diff --git a/frontend/src/providers/Dashboard/store/dashboardVariables/dashboardVariablesStoreTypes.ts b/frontend/src/providers/Dashboard/store/dashboardVariables/dashboardVariablesStoreTypes.tsnew file mode 100644index 0000000000..210a335609--- /dev/null+++ b/frontend/src/providers/Dashboard/store/dashboardVariables/dashboardVariablesStoreTypes.ts@@ -0,0 +1,31 @@+import { IDashboardVariable } from 'types/api/dashboard/getAll';++export type VariableGraph = Record<string, string[]>;++export interface IDependencyData {+ order: string[];+ graph: VariableGraph;+ parentDependencyGraph: VariableGraph;+ hasCycle: boolean;+ cycleNodes?: string[];+}++export type IDashboardVariables = Record<string, IDashboardVariable>;++export interface IDashboardVariablesStoreState {+ // dashboard id+ dashboardId: string;++ // Raw variables keyed by id/name+ variables: IDashboardVariables;++ // Derived: sorted array of variables by order+ sortedVariablesArray: IDashboardVariable[];++ // Derived: dependency data for QUERY variables+ dependencyData: IDependencyData | null;+}++export interface IUseDashboardVariablesReturn {+ dashboardVariables: IDashboardVariablesStoreState['variables'];+}diff --git a/frontend/src/providers/Dashboard/store/dashboardVariables/dashboardVariablesStoreUtils.ts b/frontend/src/providers/Dashboard/store/dashboardVariables/dashboardVariablesStoreUtils.tsnew file mode 100644index 0000000000..1abca538eb--- /dev/null+++ b/frontend/src/providers/Dashboard/store/dashboardVariables/dashboardVariablesStoreUtils.ts@@ -0,0 +1,89 @@+import {+ buildDependencies,+ buildDependencyGraph,+} from 'container/DashboardContainer/DashboardVariablesSelection/util';+import { IDashboardVariable } from 'types/api/dashboard/getAll';++import {+ IDashboardVariables,+ IDashboardVariablesStoreState,+ IDependencyData,+} from './dashboardVariablesStoreTypes';++/**+ * Build a sorted array of variables by their order property+ */+export function buildSortedVariablesArray(+ variables: IDashboardVariables,+): IDashboardVariable[] {+ const sortedVariablesArray: IDashboardVariable[] = [];++ Object.values(variables).forEach((value) => {+ sortedVariablesArray.push({ ...value });+ });++ sortedVariablesArray.sort((a, b) => a.order - b.order);++ return sortedVariablesArray;+}++/**+ * Build dependency data from sorted variables array+ * This includes the dependency graph, topological order, and cycle detection+ */+export function buildDependencyData(+ sortedVariablesArray: IDashboardVariable[],+): IDependencyData | null {+ if (sortedVariablesArray.length === 0) {+ return null;+ }++ const dependencies = buildDependencies(sortedVariablesArray);+ const {+ order,+ graph,+ parentDependencyGraph,+ hasCycle,+ cycleNodes,+ } = buildDependencyGraph(dependencies);++ // Filter order to only include QUERY type variables+ const queryVariableOrder = order.filter((variable: string) => {+ const variableData = sortedVariablesArray.find((v) => v.name === variable);+ return variableData?.type === 'QUERY';+ });++ return {+ order: queryVariableOrder,+ graph,+ parentDependencyGraph,+ hasCycle,+ cycleNodes,+ };+}++/**+ * Compute derived values from variables+ * This is a composition of buildSortedVariablesArray and buildDependencyData+ */+export function computeDerivedValues(+ variables: IDashboardVariablesStoreState['variables'],+): Pick<+ IDashboardVariablesStoreState,+ 'sortedVariablesArray' | 'dependencyData'+> {+ const sortedVariablesArray = buildSortedVariablesArray(variables);+ const dependencyData = buildDependencyData(sortedVariablesArray);++ return { sortedVariablesArray, dependencyData };+}++/**+ * Update derived values in the store state (for use with immer)+ */+export function updateDerivedValues(+ draft: IDashboardVariablesStoreState,+): void {+ draft.sortedVariablesArray = buildSortedVariablesArray(draft.variables);+ draft.dependencyData = buildDependencyData(draft.sortedVariablesArray);+}diff --git a/frontend/src/providers/Dashboard/store/dashboardVariablesStore.ts b/frontend/src/providers/Dashboard/store/dashboardVariablesStore.tsdeleted file mode 100644index a5c66be8b6..0000000000--- a/frontend/src/providers/Dashboard/store/dashboardVariablesStore.ts+++ /dev/null@@ -1,14 +0,0 @@-import { IDashboardVariable } from 'types/api/dashboard/getAll';--import createStore from './store';--// export type IDashboardVariables = DashboardData['variables'];-export type IDashboardVariables = Record<string, IDashboardVariable>;--export const dashboardVariablesStore = createStore<IDashboardVariables>({});--export function setDashboardVariablesStore(- variables: Partial<IDashboardVariables>,-): void {- dashboardVariablesStore.set(() => ({ ...variables }));-}