From cff0e1cf1e87100145e33c1bb87826fbcf5e2f71 Mon Sep 17 00:00:00 2001 From: Vikrant Gupta Date: Tue, 13 Feb 2024 13:57:24 +0530 Subject: [PATCH] fix: old and new dashboards in sync with local storage (#4520) * fix: old and new dashboards in sync with local storage * fix: remove code * fix: remove console log * fix: remove console log --- .../DashboardVariablesSelection/DashboardVariableSelection.tsx | 2 +- frontend/src/providers/Dashboard/Dashboard.tsx | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/frontend/src/container/NewDashboard/DashboardVariablesSelection/DashboardVariableSelection.tsx b/frontend/src/container/NewDashboard/DashboardVariablesSelection/DashboardVariableSelection.tsx index 8ced5b2b22..8d67a8250b 100644 --- a/frontend/src/container/NewDashboard/DashboardVariablesSelection/DashboardVariableSelection.tsx +++ b/frontend/src/container/NewDashboard/DashboardVariablesSelection/DashboardVariableSelection.tsx @@ -73,7 +73,7 @@ function DashboardVariableSelection(): JSX.Element | null { return variableCopy; }, ); - updateLocalStorageDashboardVariables(id, value, allSelected); + updateLocalStorageDashboardVariables(name, value, allSelected); const variables = convertVariablesToDbFormat(newVariablesArr); diff --git a/frontend/src/providers/Dashboard/Dashboard.tsx b/frontend/src/providers/Dashboard/Dashboard.tsx index 158374ec3c..a7fa94c044 100644 --- a/frontend/src/providers/Dashboard/Dashboard.tsx +++ b/frontend/src/providers/Dashboard/Dashboard.tsx @@ -116,9 +116,10 @@ export function DashboardProvider({ if (data && localStorageVariables) { const updatedVariables = data.data.variables; Object.keys(data.data.variables).forEach((variable) => { + const variableData = data.data.variables[variable]; const updatedVariable = { ...data.data.variables[variable], - ...localStorageVariables[variable as any], + ...localStorageVariables[variableData.name as any], }; updatedVariables[variable] = updatedVariable;