From 0811a45355245c8bdcb97da94c40091c4a4dd09e Mon Sep 17 00:00:00 2001 From: Your Name Date: Sat, 11 Oct 2025 18:09:01 +0800 Subject: [PATCH 1/3] fix: do not display shortcut if it is not initialized --- code/core/src/manager/settings/shortcuts.tsx | 51 +++++++++++--------- 1 file changed, 28 insertions(+), 23 deletions(-) diff --git a/code/core/src/manager/settings/shortcuts.tsx b/code/core/src/manager/settings/shortcuts.tsx index 03c644e18be5..b20ab4614bf6 100644 --- a/code/core/src/manager/settings/shortcuts.tsx +++ b/code/core/src/manager/settings/shortcuts.tsx @@ -230,7 +230,7 @@ class ShortcutsScreen extends Component { const { shortcutKeys, activeFeature } = this.state; - + if (shortcutKeys[activeFeature]) { const { shortcut, error } = shortcutKeys[activeFeature]; if (!shortcut || error) { @@ -288,28 +288,33 @@ class ShortcutsScreen extends Component { const { shortcutKeys, addonsShortcutLabels } = this.state; // @ts-expect-error (non strict) - const arr = Object.entries(shortcutKeys).map(([feature, { shortcut }]: [Feature, any]) => ( - - {/* @ts-expect-error (non strict) */} - {shortcutLabels[feature] || addonsShortcutLabels[feature]} - - - - {/* @ts-expect-error (non strict) */} - - - )); + const arr = Object.entries(shortcutKeys).map(([feature, { shortcut }]: [Feature, any]) => { + if (shortcutLabels[feature] === undefined && (!addonsShortcutLabels || !addonsShortcutLabels[feature])) { + return; + } + return ( + + {/* @ts-expect-error (non strict) */} + {shortcutLabels[feature] || addonsShortcutLabels[feature]} + + + + {/* @ts-expect-error (non strict) */} + + + ); + }); return arr; }; From dd36a588564bc342475395fdc5fb49d011db9ac1 Mon Sep 17 00:00:00 2001 From: Your Name Date: Sat, 11 Oct 2025 18:39:40 +0800 Subject: [PATCH 2/3] refactor --- code/core/src/manager/settings/shortcuts.tsx | 58 ++++++++++---------- 1 file changed, 29 insertions(+), 29 deletions(-) diff --git a/code/core/src/manager/settings/shortcuts.tsx b/code/core/src/manager/settings/shortcuts.tsx index b20ab4614bf6..4aab128da060 100644 --- a/code/core/src/manager/settings/shortcuts.tsx +++ b/code/core/src/manager/settings/shortcuts.tsx @@ -230,7 +230,7 @@ class ShortcutsScreen extends Component { const { shortcutKeys, activeFeature } = this.state; - + if (shortcutKeys[activeFeature]) { const { shortcut, error } = shortcutKeys[activeFeature]; if (!shortcut || error) { @@ -287,34 +287,34 @@ class ShortcutsScreen extends Component { const { shortcutKeys, addonsShortcutLabels } = this.state; - // @ts-expect-error (non strict) - const arr = Object.entries(shortcutKeys).map(([feature, { shortcut }]: [Feature, any]) => { - if (shortcutLabels[feature] === undefined && (!addonsShortcutLabels || !addonsShortcutLabels[feature])) { - return; - } - return ( - - {/* @ts-expect-error (non strict) */} - {shortcutLabels[feature] || addonsShortcutLabels[feature]} - - - - {/* @ts-expect-error (non strict) */} - - - ); - }); + const availableShortcuts = (Object.entries(shortcutKeys) as [Feature, any][]).filter( + ([feature]: [Feature, any]) => + shortcutLabels[feature] !== undefined || + (addonsShortcutLabels && addonsShortcutLabels[feature]) + ); + + const arr = availableShortcuts.map(([feature, { shortcut }]: [Feature, any]) => ( + + {/* @ts-expect-error (non strict) */} + {shortcutLabels[feature] || addonsShortcutLabels[feature]} + + + + {/* @ts-expect-error (non strict) */} + + + )); return arr; }; From 0c1d8f680d1f89f994c90c73017950b98f42c239 Mon Sep 17 00:00:00 2001 From: Bryan Dang <82434977+DKER2@users.noreply.github.com> Date: Wed, 15 Oct 2025 22:31:46 +0800 Subject: [PATCH 3/3] Update code/core/src/manager/settings/shortcuts.tsx Co-authored-by: Steve Dodier-Lazaro --- code/core/src/manager/settings/shortcuts.tsx | 1 + 1 file changed, 1 insertion(+) diff --git a/code/core/src/manager/settings/shortcuts.tsx b/code/core/src/manager/settings/shortcuts.tsx index 4aab128da060..ac1a94407068 100644 --- a/code/core/src/manager/settings/shortcuts.tsx +++ b/code/core/src/manager/settings/shortcuts.tsx @@ -287,6 +287,7 @@ class ShortcutsScreen extends Component { const { shortcutKeys, addonsShortcutLabels } = this.state; + // Filter out keyboard shortcuts from localStorage that no longer exist in code const availableShortcuts = (Object.entries(shortcutKeys) as [Feature, any][]).filter( ([feature]: [Feature, any]) => shortcutLabels[feature] !== undefined ||