From d17c7ecbd461f4f92d730602a9e6179e0ad82daf Mon Sep 17 00:00:00 2001 From: JimmFly Date: Fri, 23 Dec 2022 12:49:54 +0800 Subject: [PATCH] fix: currentWorkspace not found when quick search --- packages/app/src/components/quick-search/index.tsx | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/packages/app/src/components/quick-search/index.tsx b/packages/app/src/components/quick-search/index.tsx index 8d0d134a74..85753a59f0 100644 --- a/packages/app/src/components/quick-search/index.tsx +++ b/packages/app/src/components/quick-search/index.tsx @@ -27,11 +27,13 @@ export const QuickSearch = ({ open, onClose }: TransitionsModalProps) => { const [showCreatePage, setShowCreatePage] = useState(true); const { triggerQuickSearchModal } = useModal(); const { currentWorkspaceId, workspacesMeta } = useAppState(); - // Add ‘⌘+K’ shortcut keys as switches - const isPublic = workspacesMeta.find( - ({ id }) => id === currentWorkspaceId - )?.public; + const currentWorkspace = workspacesMeta.find( + meta => String(meta.id) === String(currentWorkspaceId) + ); + const isPublic = currentWorkspace?.public; + + // Add ‘⌘+K’ shortcut keys as switches useEffect(() => { const down = (e: KeyboardEvent) => { if (e.key === 'k' && e.metaKey) {