diff --git a/src-tauri/src/core/profiles.rs b/src-tauri/src/core/profiles.rs index 7fa8058..d82d48d 100644 --- a/src-tauri/src/core/profiles.rs +++ b/src-tauri/src/core/profiles.rs @@ -380,8 +380,7 @@ impl Profiles { patch!(each, item, url); patch!(each, item, selected); patch!(each, item, extra); - - each.updated = Some(help::get_now()); + patch!(each, item, updated); self.items = Some(items); return self.save_file(); diff --git a/src/components/proxy/proxy-group.tsx b/src/components/proxy/proxy-group.tsx index acd516d..61be923 100644 --- a/src/components/proxy/proxy-group.tsx +++ b/src/components/proxy/proxy-group.tsx @@ -75,7 +75,7 @@ const ProxyGroup = ({ group }: Props) => { } else { profile.selected[index] = { name: group.name, now: name }; } - await patchProfile(profiles!.current!, profile); + await patchProfile(profiles!.current!, { selected: profile.selected }); } catch (err) { console.error(err); } diff --git a/src/pages/profiles.tsx b/src/pages/profiles.tsx index db456e4..e138e52 100644 --- a/src/pages/profiles.tsx +++ b/src/pages/profiles.tsx @@ -81,7 +81,10 @@ const ProfilePage = () => { name, now, })); - patchProfile(current!, profile).catch(console.error); + + patchProfile(current!, { selected: profile.selected }).catch( + console.error + ); // update proxies cache if (hasChange) mutate("getProxies", getProxies()); }, 100); diff --git a/src/services/cmds.ts b/src/services/cmds.ts index 057809e..f01f153 100644 --- a/src/services/cmds.ts +++ b/src/services/cmds.ts @@ -35,7 +35,7 @@ export async function deleteProfile(index: string) { export async function patchProfile( index: string, - profile: CmdType.ProfileItem + profile: Partial ) { return invoke("patch_profile", { index, profile }); }