From 9263f70d6af1ce2db2217d644176f46ef147a4c4 Mon Sep 17 00:00:00 2001 From: Andrey Antukh Date: Thu, 28 Jul 2022 09:36:52 +0200 Subject: [PATCH] :sparkles: Use properly the react hook We can't use hooks in a condition, the condition should be inside the hook. --- frontend/src/app/main/ui/workspace/context_menu.cljs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/frontend/src/app/main/ui/workspace/context_menu.cljs b/frontend/src/app/main/ui/workspace/context_menu.cljs index ee2378b15..e010e0c56 100644 --- a/frontend/src/app/main/ui/workspace/context_menu.cljs +++ b/frontend/src/app/main/ui/workspace/context_menu.cljs @@ -70,9 +70,10 @@ (when (and (some? dom) (some? submenu-node)) (dom/set-css-property! submenu-node "top" (str (.-offsetTop dom) "px"))))))] - (when on-unmount - (mf/use-effect - (fn [] on-unmount))) + + (mf/use-effect + (mf/deps on-unmount) + (constantly on-unmount)) (if icon [:li.icon-menu-item {:ref set-dom-node