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
This commit is contained in:
Vikrant Gupta 2024-02-13 13:57:24 +05:30 committed by GitHub
parent 02f83e4b4a
commit cff0e1cf1e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 3 additions and 2 deletions

View File

@ -73,7 +73,7 @@ function DashboardVariableSelection(): JSX.Element | null {
return variableCopy; return variableCopy;
}, },
); );
updateLocalStorageDashboardVariables(id, value, allSelected); updateLocalStorageDashboardVariables(name, value, allSelected);
const variables = convertVariablesToDbFormat(newVariablesArr); const variables = convertVariablesToDbFormat(newVariablesArr);

View File

@ -116,9 +116,10 @@ export function DashboardProvider({
if (data && localStorageVariables) { if (data && localStorageVariables) {
const updatedVariables = data.data.variables; const updatedVariables = data.data.variables;
Object.keys(data.data.variables).forEach((variable) => { Object.keys(data.data.variables).forEach((variable) => {
const variableData = data.data.variables[variable];
const updatedVariable = { const updatedVariable = {
...data.data.variables[variable], ...data.data.variables[variable],
...localStorageVariables[variable as any], ...localStorageVariables[variableData.name as any],
}; };
updatedVariables[variable] = updatedVariable; updatedVariables[variable] = updatedVariable;