Skip to content

Commit

Permalink
Fix controlled values flag
Browse files Browse the repository at this point in the history
  • Loading branch information
Onitoxan committed Nov 25, 2024
1 parent 116cf2a commit 8ad2f3d
Showing 1 changed file with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -127,8 +127,11 @@ const AsyncAutocompleteSelect = ({
!onChange && Array.isArray(field.value) && field.value.length === 0;
const isEmptyUncontrolledFormObjectValue = !onChange && !field.value;
const isEmptyControlledFormObjectValueArray =
onChange && Array.isArray(controlledValue) && controlledValue.length === 0;
const isEmptyControlledFormObjectValue = onChange && !controlledValue;
onChange &&
((Array.isArray(controlledValue) && controlledValue.length === 0) ||
(Array.isArray(initialValue) && initialValue.length === 0));
const isEmptyControlledFormObjectValue =
onChange && !(controlledValue ?? initialValue);

useEffect(() => {
const delay = isFetch ? 0 : 300;
Expand Down

0 comments on commit 8ad2f3d

Please sign in to comment.