From 14d1562903dc8c102873c0bdde8757cf8b393478 Mon Sep 17 00:00:00 2001 From: SuperComboGamer Date: Sat, 13 Dec 2025 01:35:18 -0500 Subject: [PATCH] fix: handle undefined shortcuts in parseShortcut and formatShortcut MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add guards to handle undefined/null shortcuts for users with old persisted state missing the new terminal shortcuts. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 --- apps/app/src/store/app-store.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/apps/app/src/store/app-store.ts b/apps/app/src/store/app-store.ts index 5a0f0bd8..409d001b 100644 --- a/apps/app/src/store/app-store.ts +++ b/apps/app/src/store/app-store.ts @@ -48,7 +48,8 @@ export interface ShortcutKey { } // Helper to parse shortcut string to ShortcutKey object -export function parseShortcut(shortcut: string): ShortcutKey { +export function parseShortcut(shortcut: string | undefined | null): ShortcutKey { + if (!shortcut) return { key: "" }; const parts = shortcut.split("+").map((p) => p.trim()); const result: ShortcutKey = { key: parts[parts.length - 1] }; @@ -80,7 +81,8 @@ export function parseShortcut(shortcut: string): ShortcutKey { } // Helper to format ShortcutKey to display string -export function formatShortcut(shortcut: string, forDisplay = false): string { +export function formatShortcut(shortcut: string | undefined | null, forDisplay = false): string { + if (!shortcut) return ""; const parsed = parseShortcut(shortcut); const parts: string[] = [];