From 589e8f68a13e9e6c8d93025af8a3339689829a9e Mon Sep 17 00:00:00 2001 From: hevink Date: Sat, 16 May 2026 13:19:49 +0530 Subject: [PATCH] refactor: move ACTIONS_WITH_REQUIRED_ARGS to module scope Per CodeRabbit review: avoid recreating the Set on every function call by declaring it as a module-level constant, consistent with the pattern used for MODIFIER_KEYS_SET and ACTION_KEYS_SET. --- apps/web/src/actions/types.ts | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/apps/web/src/actions/types.ts b/apps/web/src/actions/types.ts index 7cc14d46..9a59f871 100644 --- a/apps/web/src/actions/types.ts +++ b/apps/web/src/actions/types.ts @@ -27,6 +27,11 @@ export type TActionWithNoArgs = Exclude; const ACTION_KEYS_SET: ReadonlySet = new Set(Object.keys(ACTIONS)); +const ACTIONS_WITH_REQUIRED_ARGS: ReadonlySet = new Set([ + "remove-media-asset", + "remove-media-assets", +]); + export function isAction(value: string): value is TAction { return ACTION_KEYS_SET.has(value); } @@ -34,10 +39,6 @@ export function isAction(value: string): value is TAction { export function isActionWithOptionalArgs(value: string): value is TActionWithOptionalArgs { if (!isAction(value)) return false; // Actions that require mandatory (non-undefined) args cannot be used as keybindings - const ACTIONS_WITH_REQUIRED_ARGS: ReadonlySet = new Set([ - "remove-media-asset", - "remove-media-assets", - ]); return !ACTIONS_WITH_REQUIRED_ARGS.has(value); }