From fe98deef4e602e96c60da0659d7ee9818facf7e3 Mon Sep 17 00:00:00 2001 From: Lucas Bordeau Date: Fri, 11 Apr 2025 14:59:48 +0200 Subject: [PATCH] Fixed command menu hotkey listener refactor (#11534) This PR fixes a refactor that was done recently to avoid having clickoutside listeners on the closed command menu. The useScopedHotkey hook should have stayed in the command menu container, because it should always listen. This has been fixed. --- .../modules/command-menu/components/CommandMenuContainer.tsx | 3 +++ .../command-menu/components/CommandMenuOpenContainer.tsx | 3 --- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/twenty-front/src/modules/command-menu/components/CommandMenuContainer.tsx b/packages/twenty-front/src/modules/command-menu/components/CommandMenuContainer.tsx index 7e14c34ed..4437f3759 100644 --- a/packages/twenty-front/src/modules/command-menu/components/CommandMenuContainer.tsx +++ b/packages/twenty-front/src/modules/command-menu/components/CommandMenuContainer.tsx @@ -2,6 +2,7 @@ import { ActionMenuComponentInstanceContext } from '@/action-menu/states/context import { CommandMenuOpenContainer } from '@/command-menu/components/CommandMenuOpenContainer'; import { COMMAND_MENU_COMPONENT_INSTANCE_ID } from '@/command-menu/constants/CommandMenuComponentInstanceId'; import { useCommandMenuCloseAnimationCompleteCleanup } from '@/command-menu/hooks/useCommandMenuCloseAnimationCompleteCleanup'; +import { useCommandMenuHotKeys } from '@/command-menu/hooks/useCommandMenuHotKeys'; import { isCommandMenuOpenedState } from '@/command-menu/states/isCommandMenuOpenedState'; import { contextStoreCurrentObjectMetadataItemIdComponentState } from '@/context-store/states/contextStoreCurrentObjectMetadataItemIdComponentState'; import { contextStoreCurrentViewIdComponentState } from '@/context-store/states/contextStoreCurrentViewIdComponentState'; @@ -46,6 +47,8 @@ export const CommandMenuContainer = ({ currentViewId ?? '', ); + useCommandMenuHotKeys(); + return ( (null); - useCommandMenuHotKeys(); - const handleClickOutside = useRecoilCallback( ({ snapshot }) => () => {