Skip to content

Commit

Permalink
Fix tauri not autosaving store on close anymore (#1209)
Browse files Browse the repository at this point in the history
  • Loading branch information
ImUrX authored Oct 26, 2024
1 parent 7cb500a commit 26ec95b
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion gui/src/components/TopBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ export function TopBar({
const { useRPCPacket, sendRPCPacket } = useWebsocketAPI();
const { useConnectedIMUTrackers } = useTrackers();
const connectedIMUTrackers = useConnectedIMUTrackers();
const { config, setConfig } = useConfig();
const { config, setConfig, saveConfig } = useConfig();
const version = useContext(VersionContext);
const [localIp, setLocalIp] = useState<string | null>(null);
const [showConnectedTrackersWarning, setConnectedTrackerWarning] =
Expand All @@ -71,6 +71,7 @@ export function TopBar({
path: '/settings/*',
});
const closeApp = async () => {
await saveConfig();
await invoke('update_window_state');
await getCurrentWebviewWindow().close();
};
Expand Down
2 changes: 1 addition & 1 deletion gui/src/hooks/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ const localStore: CrossStorage = {
};

const store: CrossStorage = isTauri()
? await createStore('gui-settings.dat')
? await createStore('gui-settings.dat', { autoSave: 100 as never })
: localStore;

function fallbackToDefaults(loadedConfig: any): Config {
Expand Down

0 comments on commit 26ec95b

Please sign in to comment.