Shun Miyazawa 2 سال پیش
والد
کامیت
346d6bcd8e
1فایلهای تغییر یافته به همراه7 افزوده شده و 3 حذف شده
  1. 7 3
      apps/app/src/components/Hotkeys/Subscribers/FocusToGlobalSearch.jsx

+ 7 - 3
apps/app/src/components/Hotkeys/Subscribers/FocusToGlobalSearch.jsx

@@ -6,7 +6,7 @@ import { useIsEditable } from '~/stores/context';
 
 const FocusToGlobalSearch = (props) => {
   const { data: isEditable } = useIsEditable();
-  const { open: openSearchModal } = useSearchModal();
+  const { data: searchModalData, open: openSearchModal } = useSearchModal();
 
   // setup effect
   useEffect(() => {
@@ -14,9 +14,13 @@ const FocusToGlobalSearch = (props) => {
       return;
     }
 
-    openSearchModal();
+    if (!searchModalData.isOpened) {
+      openSearchModal();
+      // remove this
+      props.onDeleteRender();
+    }
 
-  }, [isEditable, openSearchModal, props]);
+  }, [isEditable, openSearchModal, props, searchModalData.isOpened]);
 
   return null;
 };