From 9a5ff5b443272a758d9432b3abdb45c99be8bac8 Mon Sep 17 00:00:00 2001 From: junyuim <1861636+junyuim@users.noreply.github.com> Date: Sun, 29 Sep 2024 17:45:54 +0800 Subject: [PATCH] fix: Switch value is not in customValue error msg --- src/switch/Switch.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/switch/Switch.tsx b/src/switch/Switch.tsx index 4a1e0986e5..6d531e3e83 100644 --- a/src/switch/Switch.tsx +++ b/src/switch/Switch.tsx @@ -44,7 +44,7 @@ const Switch = React.forwardRef((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);