Skip to content

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.

chore: variable store set function (#10174)

Ashwin Bhatkalc217cc96c312
diff --git a/frontend/src/providers/Dashboard/Dashboard.tsx b/frontend/src/providers/Dashboard/Dashboard.tsx
index a53dfcd792..609e55da57 100644
--- a/frontend/src/providers/Dashboard/Dashboard.tsx
+++ b/frontend/src/providers/Dashboard/Dashboard.tsx
@@ -46,7 +46,7 @@ import { GlobalReducer } from 'types/reducer/globalTime';
import { v4 as generateUUID } from 'uuid';
import { useDashboardVariables } from '../../hooks/dashboard/useDashboardVariables';
-import { updateDashboardVariablesStore } from './store/dashboardVariablesStore';
+import { setDashboardVariablesStore } from './store/dashboardVariablesStore';
import {
DashboardSortOrder,
IDashboardContext,
@@ -205,7 +205,7 @@ export function DashboardProvider({
const updatedVariables = selectedDashboard?.data.variables || {};
if (!isEqual(existingVariables, updatedVariables)) {
- updateDashboardVariablesStore(updatedVariables);
+ setDashboardVariablesStore(updatedVariables);
}
}, [selectedDashboard]);
diff --git a/frontend/src/providers/Dashboard/store/dashboardVariablesStore.ts b/frontend/src/providers/Dashboard/store/dashboardVariablesStore.ts
index 6f64d310ba..a5c66be8b6 100644
--- a/frontend/src/providers/Dashboard/store/dashboardVariablesStore.ts
+++ b/frontend/src/providers/Dashboard/store/dashboardVariablesStore.ts
@@ -7,11 +7,8 @@ export type IDashboardVariables = Record<string, IDashboardVariable>;
export const dashboardVariablesStore = createStore<IDashboardVariables>({});
-export function updateDashboardVariablesStore(
+export function setDashboardVariablesStore(
variables: Partial<IDashboardVariables>,
): void {
- dashboardVariablesStore.update((currentVariables) => ({
- ...currentVariables,
- ...variables,
- }));
+ dashboardVariablesStore.set(() => ({ ...variables }));
}