[fix] store not saving due to dep, reset to default dir
note: changing path or start() in useEffect cause the issue
This commit is contained in:
1
src-tauri/cstb/app.json
Normal file
1
src-tauri/cstb/app.json
Normal file
@@ -0,0 +1 @@
|
|||||||
|
{"notice":"","inited":false,"hasUpdate":false,"version":"x.y.z","useMirror":true}
|
||||||
1
src-tauri/cstb/steam.json
Normal file
1
src-tauri/cstb/steam.json
Normal file
@@ -0,0 +1 @@
|
|||||||
|
{}
|
||||||
1
src-tauri/cstb/tool.json
Normal file
1
src-tauri/cstb/tool.json
Normal file
@@ -0,0 +1 @@
|
|||||||
|
{"powerPlan":0,"launchOptions":["sdfasdfasdf","-novid -high -w 1920 -h 1080 -freq 144 -sw -noborder","-novid -high -freq 144 -fullscreen -allow_third_party_software"],"launchIndex":0}
|
||||||
@@ -11,7 +11,7 @@ pub fn create_tray<R: Runtime>(app: &tauri::AppHandle<R>) -> tauri::Result<()> {
|
|||||||
let _ = TrayIconBuilder::with_id("tray")
|
let _ = TrayIconBuilder::with_id("tray")
|
||||||
.icon(app.default_window_icon().unwrap().clone())
|
.icon(app.default_window_icon().unwrap().clone())
|
||||||
.menu(&menu)
|
.menu(&menu)
|
||||||
.menu_on_left_click(false)
|
.show_menu_on_left_click(false)
|
||||||
.on_menu_event(move |app, event| match event.id.as_ref() {
|
.on_menu_event(move |app, event| match event.id.as_ref() {
|
||||||
"quit" => {
|
"quit" => {
|
||||||
app.exit(0);
|
app.exit(0);
|
||||||
|
|||||||
@@ -16,24 +16,20 @@ import { /* relaunch, */ exit } from "@tauri-apps/plugin-process"
|
|||||||
import { useTheme } from "next-themes"
|
import { useTheme } from "next-themes"
|
||||||
// import { platform } from "@tauri-apps/plugin-os"
|
// import { platform } from "@tauri-apps/plugin-os"
|
||||||
import { usePathname, useRouter } from "next/navigation"
|
import { usePathname, useRouter } from "next/navigation"
|
||||||
|
import { saveAll } from "tauri-plugin-valtio"
|
||||||
|
|
||||||
const Nav = () => {
|
const Nav = () => {
|
||||||
const { theme, setTheme } = useTheme()
|
const { theme, setTheme } = useTheme()
|
||||||
|
|
||||||
const close = async () => {
|
const close = async () => {
|
||||||
// (await window.hideOnClose) ? getCurrent().hide() : exit();
|
// (await window.hideOnClose) ? getCurrent().hide() : exit();
|
||||||
|
await saveAll()
|
||||||
await exit()
|
await exit()
|
||||||
}
|
}
|
||||||
|
|
||||||
const minimize = () => {
|
const minimize = async () => {
|
||||||
getCurrentWindow()
|
await saveAll()
|
||||||
.minimize()
|
await getCurrentWindow().minimize()
|
||||||
.then(() => {
|
|
||||||
console.log("minimized")
|
|
||||||
})
|
|
||||||
.catch((err: unknown) => {
|
|
||||||
console.error(err)
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const toggleMaximize = async () => {
|
const toggleMaximize = async () => {
|
||||||
|
|||||||
@@ -1,20 +1,20 @@
|
|||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
import path from "path"
|
// import path from "path"
|
||||||
import { appConfigDir } from "@tauri-apps/api/path"
|
// import { appConfigDir } from "@tauri-apps/api/path"
|
||||||
import { setValtioPath } from "tauri-plugin-valtio"
|
// import { setValtioPath } from "tauri-plugin-valtio"
|
||||||
|
|
||||||
async function init() {
|
// async function init() {
|
||||||
const configDir = await appConfigDir()
|
// const configDir = await appConfigDir()
|
||||||
const distDir = path.join(configDir, "cstb")
|
// const distDir = path.join(configDir, "cstb")
|
||||||
await setValtioPath(distDir)
|
// await setValtioPath(distDir)
|
||||||
// console.log('init valtio', distDir);
|
// // console.log('init valtio', distDir);
|
||||||
}
|
// }
|
||||||
|
|
||||||
void init()
|
// void init()
|
||||||
|
|
||||||
export const DEFAULT_STORE_CONFIG = {
|
export const DEFAULT_STORE_CONFIG = {
|
||||||
saveOnChange: true,
|
saveOnChange: true,
|
||||||
saveOnExit: true,
|
saveOnExit: true,
|
||||||
saveStrategy: "debounce" as const,
|
saveStrategy: "debounce" as const,
|
||||||
saveInterval: 3000,
|
saveInterval: 2000,
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user