diff --git a/src/components/FormBuilder/FormBuilder.js b/src/components/FormBuilder/FormBuilder.js index b8e40d1..9c3961b 100644 --- a/src/components/FormBuilder/FormBuilder.js +++ b/src/components/FormBuilder/FormBuilder.js @@ -37,12 +37,17 @@ const FormBuilder = (props) => { const timer = setTimeout(() => { getPageWidth(); }, 0); - window.addEventListener("resize", getPageWidth); + + if (showActionButtons) { + window.addEventListener("resize", getPageWidth); + } return () => { - window.removeEventListener("resize", getPageWidth); + if (showActionButtons) { + window.removeEventListener("resize", getPageWidth); + } clearTimeout(timer); }; - }, []); + }, [showActionButtons]); const handleCancel = () => { window.history.back();