mirror of
https://github.com/ToolJet/ToolJet
synced 2026-05-24 09:28:31 +00:00
reset t0 default value when optin values gets an update
This commit is contained in:
parent
56165ad8bd
commit
c0bcaa1d7f
1 changed files with 13 additions and 0 deletions
|
|
@ -63,6 +63,19 @@ export const DropDown = function DropDown({
|
|||
const value = currentValueProperty ? currentValueProperty.value : '';
|
||||
const [currentValue, setCurrentValue] = useState('');
|
||||
|
||||
const [optionValues, setOptionValue] = useState(() => selectOptions);
|
||||
|
||||
useEffect(() => {
|
||||
const nextOptionValues = JSON.stringify(parsedValues);
|
||||
const prevOptionValues = JSON.stringify(optionValues);
|
||||
|
||||
if (nextOptionValues !== prevOptionValues) {
|
||||
setOptionValue(() => JSON.parse(nextOptionValues));
|
||||
setCurrentValue('');
|
||||
}
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, [parsedValues]);
|
||||
|
||||
let newValue = value;
|
||||
if (currentValueProperty && currentState) {
|
||||
newValue = resolveReferences(currentValueProperty.value, currentState, '');
|
||||
|
|
|
|||
Loading…
Reference in a new issue