fix: removed the incorrect useEffect and updated deps array

This commit is contained in:
jongomez 2023-09-29 13:08:47 +01:00 committed by Jon
parent ce779c3903
commit 5c9c23fd30
1 changed files with 2 additions and 3 deletions

View File

@ -83,10 +83,9 @@ export const Dropdown: React.FC<DropdownProps> & {
handleToggle(!openState) handleToggle(!openState)
} }
// Handle the controlled version of the component:
useEffect(() => { useEffect(() => {
typeof isOpen !== 'undefined' && setOpenState(isOpen) if (disabled && openState && !isControlled) setOpenState(false)
}, [isOpen]) }, [openState, disabled, isControlled])
const buttonId = props?.id ?? (props.id || 'dropdown') + '-input' const buttonId = props?.id ?? (props.id || 'dropdown') + '-input'