mirror of
https://github.com/farcasclaudiu/Flowise.git
synced 2026-06-28 07:00:49 +03:00
fix: warning when a non-boolean values was used to set checked prop of a SwitchInput component (#3276)
fix: warning when a non-boolean values was used to set`checked` prop of SwitchInput component The problem was that in the useEffect hook the plain value was used without validation like in useState
This commit is contained in:
committed by
GitHub
parent
da0a15eee1
commit
99cb8c32cb
@@ -6,7 +6,7 @@ export const SwitchInput = ({ label, value, onChange, disabled = false }) => {
|
||||
const [myValue, setMyValue] = useState(value !== undefined ? !!value : false)
|
||||
|
||||
useEffect(() => {
|
||||
setMyValue(value)
|
||||
setMyValue(value !== undefined ? !!value : false)
|
||||
}, [value])
|
||||
|
||||
return (
|
||||
|
||||
Reference in New Issue
Block a user