Skip to content

Commit 4f7dc5e

Browse files
committed
fix: remap split-element keybinding to split
1 parent 4e8b7d3 commit 4f7dc5e

File tree

2 files changed

+22
-1
lines changed

2 files changed

+22
-1
lines changed

apps/web/src/stores/keybindings/migrations/index.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { v2ToV3 } from "./v2-to-v3";
22
import { v3ToV4 } from "./v3-to-v4";
33
import { v4ToV5 } from "./v4-to-v5";
44
import { v5ToV6 } from "./v5-to-v6";
5+
import { v6ToV7 } from "./v6-to-v7";
56

67
type MigrationFn = ({ state }: { state: unknown }) => unknown;
78

@@ -10,9 +11,10 @@ const migrations: Record<number, MigrationFn> = {
1011
3: v3ToV4,
1112
4: v4ToV5,
1213
5: v5ToV6,
14+
6: v6ToV7,
1315
};
1416

15-
export const CURRENT_VERSION = 6;
17+
export const CURRENT_VERSION = 7;
1618

1719
export function runMigrations({
1820
state,
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
import type { KeybindingConfig } from "@/lib/actions/keybinding";
2+
3+
interface V6State {
4+
keybindings: KeybindingConfig;
5+
isCustomized: boolean;
6+
}
7+
8+
export function v6ToV7({ state }: { state: unknown }): unknown {
9+
const v6 = state as V6State;
10+
const keybindings = { ...v6.keybindings };
11+
12+
for (const key of Object.keys(keybindings) as Array<keyof KeybindingConfig>) {
13+
if (keybindings[key] === ("split-element" as never)) {
14+
keybindings[key] = "split";
15+
}
16+
}
17+
18+
return { ...v6, keybindings };
19+
}

0 commit comments

Comments
 (0)