fix: dependent variable panel not updating (#5283)

* fix: dependent variable panel not updating

* fix: build issues
This commit is contained in:
Vikrant Gupta 2024-06-20 17:21:04 +05:30 committed by GitHub
parent 38b1de5ccc
commit 67965c8e4d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 13 additions and 0 deletions

View File

@ -138,6 +138,7 @@ function DashboardVariableSelection(): JSX.Element | null {
}}
onValueUpdate={onValueUpdate}
variablesToGetUpdated={variablesToGetUpdated}
setVariablesToGetUpdated={setVariablesToGetUpdated}
/>
))}
</Row>

View File

@ -54,6 +54,7 @@ describe('VariableItem', () => {
existingVariables={{}}
onValueUpdate={mockOnValueUpdate}
variablesToGetUpdated={[]}
setVariablesToGetUpdated={(): void => {}}
/>
</MockQueryClientProvider>,
);
@ -69,6 +70,7 @@ describe('VariableItem', () => {
existingVariables={{}}
onValueUpdate={mockOnValueUpdate}
variablesToGetUpdated={[]}
setVariablesToGetUpdated={(): void => {}}
/>
</MockQueryClientProvider>,
);
@ -83,6 +85,7 @@ describe('VariableItem', () => {
existingVariables={{}}
onValueUpdate={mockOnValueUpdate}
variablesToGetUpdated={[]}
setVariablesToGetUpdated={(): void => {}}
/>
</MockQueryClientProvider>,
);
@ -111,6 +114,7 @@ describe('VariableItem', () => {
existingVariables={{}}
onValueUpdate={mockOnValueUpdate}
variablesToGetUpdated={[]}
setVariablesToGetUpdated={(): void => {}}
/>
</MockQueryClientProvider>,
);
@ -134,6 +138,7 @@ describe('VariableItem', () => {
existingVariables={{}}
onValueUpdate={mockOnValueUpdate}
variablesToGetUpdated={[]}
setVariablesToGetUpdated={(): void => {}}
/>
</MockQueryClientProvider>,
);
@ -149,6 +154,7 @@ describe('VariableItem', () => {
existingVariables={{}}
onValueUpdate={mockOnValueUpdate}
variablesToGetUpdated={[]}
setVariablesToGetUpdated={(): void => {}}
/>
</MockQueryClientProvider>,
);

View File

@ -52,6 +52,7 @@ interface VariableItemProps {
allSelected: boolean,
) => void;
variablesToGetUpdated: string[];
setVariablesToGetUpdated: React.Dispatch<React.SetStateAction<string[]>>;
}
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) {