diff --git a/src/lib/plugins/command.ts b/src/lib/plugins/command.ts index 6387955..e4b641e 100644 --- a/src/lib/plugins/command.ts +++ b/src/lib/plugins/command.ts @@ -112,7 +112,7 @@ export interface PluginLoadResult { } export async function loadInstalledPlugins(): Promise { - const list = getStore(installedPlugins) + const list = await installedPlugins.getValue() const plugins = ( await Promise.all( list.map(async (it) => { diff --git a/src/lib/utils/localStore.ts b/src/lib/utils/localStore.ts index 5f47a23..358037c 100644 --- a/src/lib/utils/localStore.ts +++ b/src/lib/utils/localStore.ts @@ -10,7 +10,9 @@ export function localStore( key: string, initial: T, adapter: LocalStoreAdapter, -): Writable { +): Writable & { + getValue(): Promise +} { const { subscribe, set, update } = writable(initial) const r = adapter.read(key) const init = (r: T | undefined | null) => @@ -29,6 +31,11 @@ export function localStore( return value }) }, + async getValue() { + const r = await adapter.read(key) + set(r) + return r + }, } } diff --git a/vite.config.ts b/vite.config.ts index fe27640..2a7519f 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -68,5 +68,6 @@ export default defineConfig({ }, build: { target: 'esnext', + sourcemap: true, }, })