Skip to content

Commit

Permalink
🐛 - fix: fix a bug that could cause a select not to be cleared correctly
Browse files Browse the repository at this point in the history
  • Loading branch information
svenvandescheur committed Jun 28, 2024
1 parent aaee530 commit 7650352
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/components/form/form/form.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -123,11 +123,11 @@ export const Form: React.FC<FormProps> = ({
const [errorsState, setErrorsState] = useState(errors || {});

useEffect(() => {
return values && setValuesState(values);
values && setValuesState(values);
}, [values]);

useEffect(() => {
return errors && setErrorsState(errors);
errors && setErrorsState(errors);
}, [errors]);

const intl = useIntl();
Expand Down
2 changes: 2 additions & 0 deletions src/components/form/select/select.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -130,8 +130,10 @@ export const Select: React.FC<SelectProps> = ({
);

if (index === -1) {
setSelectedIndex(null);
return;
}

setSelectedIndex(index);
}, [value, options]);

Expand Down

0 comments on commit 7650352

Please sign in to comment.