Skip to content

Commit bb8dffc

Browse files
mswiszczclaude
andcommitted
fix: address code review feedback for keybindings feature
- Fix hasJsonView to omit (array format, not key-value) and add docsUrl - Add runtime validation in buildKeyMaps for malformed override entries - Fix mock default config to use "[]" instead of empty string Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent d47fd03 commit bb8dffc

File tree

3 files changed

+10
-2
lines changed

3 files changed

+10
-2
lines changed

frontend/app/store/keymodel.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -840,6 +840,14 @@ function buildKeyMaps(userOverrides: KeybindingEntry[]): void {
840840

841841
// 2. Apply user overrides in order (last wins)
842842
for (const override of userOverrides) {
843+
if (!override.command || typeof override.command !== "string") {
844+
console.warn("Skipping keybinding entry with missing/invalid command");
845+
continue;
846+
}
847+
if (override.key != null && typeof override.key !== "string") {
848+
console.warn(`Skipping keybinding entry with invalid key type for command: ${override.command}`);
849+
continue;
850+
}
843851
const commandId = override.command.startsWith("-") ? override.command.substring(1) : override.command;
844852
if (override.command.startsWith("-") || override.key == null) {
845853
// Unbind: remove the action

frontend/app/view/waveconfig/waveconfig-model.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ function makeConfigFiles(isWindows: boolean): ConfigFile[] {
6969
path: "keybindings.json",
7070
language: "json",
7171
description: "Custom keyboard shortcuts",
72-
hasJsonView: true,
72+
docsUrl: "https://docs.waveterm.dev/keybindings",
7373
},
7474
{
7575
name: "Connections",

frontend/preview/mock/defaultconfig.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,6 @@ export const DefaultFullConfig: FullConfigType = {
2020
bookmarks: {},
2121
waveai: waveaiJson as unknown as { [key: string]: AIModeConfigType },
2222
backgrounds: backgroundsJson as { [key: string]: BackgroundConfigType },
23-
keybindings: "",
23+
keybindings: "[]",
2424
configerrors: [],
2525
};

0 commit comments

Comments
 (0)