Skip to content

Commit

Permalink
fix: Switch value is not in customValue error msg
Browse files Browse the repository at this point in the history
  • Loading branch information
junyugit authored Sep 29, 2024
1 parent d6933f1 commit 9a5ff5b
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/switch/Switch.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ const Switch = React.forwardRef<HTMLButtonElement, SwitchProps>((originalProps,
};

useEffect(() => {
if (Array.isArray(customValue) && !customValue.includes(value)) {
if (isControlled && Array.isArray(customValue) && !customValue.includes(value)) {
log.error('Switch', `value is not in customValue: ${JSON.stringify(customValue)}`);
}
isControlled && setInnerChecked(value === activeValue);
Expand Down

0 comments on commit 9a5ff5b

Please sign in to comment.