From 991258084e0884fbdd2a11cb821cc6a083690855 Mon Sep 17 00:00:00 2001 From: Dakshesh Jain <65905942+dakshesh14@users.noreply.github.com> Date: Mon, 11 Sep 2023 13:21:50 +0530 Subject: [PATCH] fix: query checking (#2137) fix: the logic should be to check if object exist not if it's true or false --- web/pages/m/[workspaceSlug]/editor.tsx | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/web/pages/m/[workspaceSlug]/editor.tsx b/web/pages/m/[workspaceSlug]/editor.tsx index 296b05ac9..2bfac63b8 100644 --- a/web/pages/m/[workspaceSlug]/editor.tsx +++ b/web/pages/m/[workspaceSlug]/editor.tsx @@ -25,12 +25,7 @@ const Editor: NextPage = () => { const isEditable = editable === "true"; - const { - watch, - setValue, - control, - formState: { errors }, - } = useForm({ + const { watch, setValue, control } = useForm({ defaultValues: { data: "", data_html: "", @@ -39,11 +34,11 @@ const Editor: NextPage = () => { useEffect(() => { setIsLoading(true); - if (!isEditable) return; + if (!router?.query?.["editable"]) return; setIsLoading(false); const data_html = Cookies.get("data_html"); setValue("data_html", data_html ?? ""); - }, [isEditable, setValue]); + }, [isEditable, setValue, router]); return (