diff --git a/frontend/src/container/NewDashboard/DashboardVariablesSelection/DashboardVariableSelection.tsx b/frontend/src/container/NewDashboard/DashboardVariablesSelection/DashboardVariableSelection.tsx index 0572196fbf..813185e0b6 100644 --- a/frontend/src/container/NewDashboard/DashboardVariablesSelection/DashboardVariableSelection.tsx +++ b/frontend/src/container/NewDashboard/DashboardVariablesSelection/DashboardVariableSelection.tsx @@ -138,6 +138,7 @@ function DashboardVariableSelection(): JSX.Element | null { }} onValueUpdate={onValueUpdate} variablesToGetUpdated={variablesToGetUpdated} + setVariablesToGetUpdated={setVariablesToGetUpdated} /> ))} diff --git a/frontend/src/container/NewDashboard/DashboardVariablesSelection/VariableItem.test.tsx b/frontend/src/container/NewDashboard/DashboardVariablesSelection/VariableItem.test.tsx index 14f20347d0..0c8fbd51ae 100644 --- a/frontend/src/container/NewDashboard/DashboardVariablesSelection/VariableItem.test.tsx +++ b/frontend/src/container/NewDashboard/DashboardVariablesSelection/VariableItem.test.tsx @@ -54,6 +54,7 @@ describe('VariableItem', () => { existingVariables={{}} onValueUpdate={mockOnValueUpdate} variablesToGetUpdated={[]} + setVariablesToGetUpdated={(): void => {}} /> , ); @@ -69,6 +70,7 @@ describe('VariableItem', () => { existingVariables={{}} onValueUpdate={mockOnValueUpdate} variablesToGetUpdated={[]} + setVariablesToGetUpdated={(): void => {}} /> , ); @@ -83,6 +85,7 @@ describe('VariableItem', () => { existingVariables={{}} onValueUpdate={mockOnValueUpdate} variablesToGetUpdated={[]} + setVariablesToGetUpdated={(): void => {}} /> , ); @@ -111,6 +114,7 @@ describe('VariableItem', () => { existingVariables={{}} onValueUpdate={mockOnValueUpdate} variablesToGetUpdated={[]} + setVariablesToGetUpdated={(): void => {}} /> , ); @@ -134,6 +138,7 @@ describe('VariableItem', () => { existingVariables={{}} onValueUpdate={mockOnValueUpdate} variablesToGetUpdated={[]} + setVariablesToGetUpdated={(): void => {}} /> , ); @@ -149,6 +154,7 @@ describe('VariableItem', () => { existingVariables={{}} onValueUpdate={mockOnValueUpdate} variablesToGetUpdated={[]} + setVariablesToGetUpdated={(): void => {}} /> , ); diff --git a/frontend/src/container/NewDashboard/DashboardVariablesSelection/VariableItem.tsx b/frontend/src/container/NewDashboard/DashboardVariablesSelection/VariableItem.tsx index e0393ea163..baa8228b3c 100644 --- a/frontend/src/container/NewDashboard/DashboardVariablesSelection/VariableItem.tsx +++ b/frontend/src/container/NewDashboard/DashboardVariablesSelection/VariableItem.tsx @@ -52,6 +52,7 @@ interface VariableItemProps { allSelected: boolean, ) => void; variablesToGetUpdated: string[]; + setVariablesToGetUpdated: React.Dispatch>; } const getSelectValue = ( @@ -73,6 +74,7 @@ function VariableItem({ existingVariables, onValueUpdate, variablesToGetUpdated, + setVariablesToGetUpdated, }: VariableItemProps): JSX.Element { const [optionsData, setOptionsData] = useState<(string | number | boolean)[]>( [], @@ -171,6 +173,10 @@ function VariableItem({ } setOptionsData(newOptionsData); + } else { + setVariablesToGetUpdated((prev) => + prev.filter((name) => name !== variableData.name), + ); } } } catch (e) {