Skip to content

Commit

Permalink
fix(gui): Lazy load tauri store
Browse files Browse the repository at this point in the history
  • Loading branch information
binarybaron committed Oct 8, 2024
1 parent 253e0b0 commit e6dc7dd
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src-gui/src/renderer/store/storeRenderer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,17 @@ const rootPersistConfig = {
};

// Use Tauri's store plugin for persistent settings
const tauriStore = await createStore(`${getNetworkName()}_settings.bin`, {
const tauriStore = createStore(`${getNetworkName()}_settings.bin`, {
autoSave: 1000 as unknown as boolean,
});

// Configure how settings are stored and retrieved using Tauri's storage
const settingsPersistConfig = {
key: "settings",
storage: {
getItem: (key: string) => tauriStore.get(key),
setItem: (key: string, value: unknown) => tauriStore.set(key, value),
removeItem: (key: string) => tauriStore.delete(key),
getItem: async (key: string) => (await tauriStore).get(key),
setItem: async (key: string, value: unknown) => (await tauriStore).set(key, value),
removeItem: async (key: string) => (await tauriStore).delete(key),
},
};

Expand Down

0 comments on commit e6dc7dd

Please sign in to comment.