diff --git a/web/src/beta/components/fields/ColorField/hooks.ts b/web/src/beta/components/fields/ColorField/hooks.ts index 31ea98e0ef..228e49b33d 100644 --- a/web/src/beta/components/fields/ColorField/hooks.ts +++ b/web/src/beta/components/fields/ColorField/hooks.ts @@ -9,6 +9,7 @@ export default ({ value, onChange }: Params) => { const [rgba, setRgba] = useState(tinycolor(value).toRgb()); const [tempColor, setTempColor] = useState(colorState); const [open, setOpen] = useState(false); + const wrapperRef = useRef(null); const pickerRef = useRef(null); @@ -78,7 +79,9 @@ export default ({ value, onChange }: Params) => { //events - const handleClick = useCallback(() => setOpen(!open), [open]); + const handleClick = useCallback(() => { + setOpen(!open); + }, [open]); const handleKeyPress = useCallback( (e: React.KeyboardEvent) => { @@ -125,7 +128,7 @@ export default ({ value, onChange }: Params) => { document.removeEventListener("mousedown", handleClickOutside); document.removeEventListener("touchstart", handleClickOutside); }; - }, [handleClose]); // eslint-disable-line react-hooks/exhaustive-deps + }, []); // eslint-disable-line react-hooks/exhaustive-deps return { wrapperRef, diff --git a/web/src/beta/components/fields/ColorField/index.tsx b/web/src/beta/components/fields/ColorField/index.tsx index b65c9f844f..db9cd48422 100644 --- a/web/src/beta/components/fields/ColorField/index.tsx +++ b/web/src/beta/components/fields/ColorField/index.tsx @@ -39,7 +39,7 @@ const ColorField: React.FC = ({ name, description, value, onChange }) => return ( - +