Skip to content

The open alternative to Salesforce, designed for AI.

Prevent command menu backspace shortcut on V1 (#10555)

Raphaël Bosidddf67ed0163
diff --git a/packages/twenty-front/src/modules/command-menu/hooks/useCommandMenuHotKeys.ts b/packages/twenty-front/src/modules/command-menu/hooks/useCommandMenuHotKeys.ts
index 012b804a765..3b3ade6f150 100644
--- a/packages/twenty-front/src/modules/command-menu/hooks/useCommandMenuHotKeys.ts
+++ b/packages/twenty-front/src/modules/command-menu/hooks/useCommandMenuHotKeys.ts
@@ -8,9 +8,11 @@ import { useKeyboardShortcutMenu } from '@/keyboard-shortcut-menu/hooks/useKeybo
import { useScopedHotkeys } from '@/ui/utilities/hotkey/hooks/useScopedHotkeys';
import { AppHotkeyScope } from '@/ui/utilities/hotkey/types/AppHotkeyScope';
import { useRecoilComponentValueV2 } from '@/ui/utilities/state/component-state/hooks/useRecoilComponentValueV2';
+import { useIsFeatureEnabled } from '@/workspace/hooks/useIsFeatureEnabled';
import { isNonEmptyString } from '@sniptt/guards';
import { useRecoilValue } from 'recoil';
import { Key } from 'ts-key-enum';
+import { FeatureFlagKey } from '~/generated-metadata/graphql';
export const useCommandMenuHotKeys = () => {
const {
@@ -31,6 +33,10 @@ export const useCommandMenuHotKeys = () => {
COMMAND_MENU_COMPONENT_INSTANCE_ID,
);
+ const isCommandMenuV2Enabled = useIsFeatureEnabled(
+ FeatureFlagKey.IsCommandMenuV2Enabled,
+ );
+
useScopedHotkeys(
'ctrl+k,meta+k',
() => {
@@ -65,7 +71,7 @@ export const useCommandMenuHotKeys = () => {
useScopedHotkeys(
[Key.Backspace, Key.Delete],
() => {
- if (isNonEmptyString(commandMenuSearch)) {
+ if (isNonEmptyString(commandMenuSearch) || !isCommandMenuV2Enabled) {
return;
}