From d5bf680b2ee99f3f57f452854f8075bbfd58df7d Mon Sep 17 00:00:00 2001 From: charan h s Date: Sat, 23 Sep 2023 09:34:09 +0530 Subject: [PATCH 1/2] delete documentedShortcuts --- src/libs/KeyboardShortcut/index.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/libs/KeyboardShortcut/index.js b/src/libs/KeyboardShortcut/index.js index 37d85c7bfbfc..050ce7d32464 100644 --- a/src/libs/KeyboardShortcut/index.js +++ b/src/libs/KeyboardShortcut/index.js @@ -83,6 +83,9 @@ _.each(CONST.KEYBOARD_SHORTCUTS, (shortcut) => { */ function unsubscribe(displayName, callbackID) { eventHandlers[displayName] = _.reject(eventHandlers[displayName], (callback) => callback.id === callbackID); + if(_.has(documentedShortcuts, displayName) && _.size(eventHandlers[displayName]) === 0){ + delete documentedShortcuts[displayName] + } } /** From 2be206582fa08a43613d44fe5b57918418ccee60 Mon Sep 17 00:00:00 2001 From: charan h s Date: Sat, 23 Sep 2023 09:46:07 +0530 Subject: [PATCH 2/2] prettier --- src/libs/KeyboardShortcut/index.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/libs/KeyboardShortcut/index.js b/src/libs/KeyboardShortcut/index.js index 050ce7d32464..f91c81a1b856 100644 --- a/src/libs/KeyboardShortcut/index.js +++ b/src/libs/KeyboardShortcut/index.js @@ -83,8 +83,8 @@ _.each(CONST.KEYBOARD_SHORTCUTS, (shortcut) => { */ function unsubscribe(displayName, callbackID) { eventHandlers[displayName] = _.reject(eventHandlers[displayName], (callback) => callback.id === callbackID); - if(_.has(documentedShortcuts, displayName) && _.size(eventHandlers[displayName]) === 0){ - delete documentedShortcuts[displayName] + if (_.has(documentedShortcuts, displayName) && _.size(eventHandlers[displayName]) === 0) { + delete documentedShortcuts[displayName]; } }