Skip to content

Commit

Permalink
fix: name of shortcuts are not correct
Browse files Browse the repository at this point in the history
  • Loading branch information
moderato-app authored and codegenius2 committed Feb 7, 2024
1 parent 1f140ce commit 17eaef9
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 3 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "talk-vite",
"private": true,
"version": "2.0.2",
"version": "2.0.3",
"type": "module",
"scripts": {
"dev": "vite",
Expand Down
1 change: 1 addition & 0 deletions src/state/app-state.ts
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ const apply = (as: AppState | null) => {
console.debug("restoring from db, key:", key)
const error = migrateAppState(as)
if (error) {
console.error(error)
throw error
}
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
Expand Down
19 changes: 18 additions & 1 deletion src/state/migration.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import {AppState} from "./app-state.ts"
import * as packageJson from '../../package.json'
import {defaultOption} from "../data-structure/client-option.tsx"
import {defaultShortcuts} from "./shortcuts.ts";
import {defaultShortcuts, KeyCombo, Shortcuts} from "./shortcuts.ts";
import semver from "semver/preload";

const currentVersion = packageJson.version
Expand Down Expand Up @@ -79,6 +79,23 @@ const steps: Step[] = [
}
return null
}
},
{
fromVersion: "2.0.0",
toVersion: "2.0.3",
action: (app: AppState): Error | null => {
const dft = defaultShortcuts()
Object.keys(app.pref.shortcuts).forEach((field) => {
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
const shortcut = dft[field] as KeyCombo|undefined
if (!shortcut){
return Error(`${field} was not found in defaultShortcuts`)
}
app.pref.shortcuts[field as keyof Shortcuts].name = shortcut.name
})
return null
}
}
]

Expand Down
2 changes: 1 addition & 1 deletion vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import react from '@vitejs/plugin-react'
import svgr from 'vite-plugin-svgr'
import {visualizer} from 'rollup-plugin-visualizer';

const VISUALIZER = true; // change to see the current bundle.
const VISUALIZER = false; // change to see the current bundle.

const bigPackages = [
'prompt.ts',
Expand Down

0 comments on commit 17eaef9

Please sign in to comment.