From ab53ab21e2f769718d490e42a03690247d8627ad Mon Sep 17 00:00:00 2001 From: GyDi Date: Fri, 9 Sep 2022 16:30:27 +0800 Subject: [PATCH] fix: delay update config --- src/components/setting/mods/core-switch.tsx | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/components/setting/mods/core-switch.tsx b/src/components/setting/mods/core-switch.tsx index 25053aad73..b4511310a4 100644 --- a/src/components/setting/mods/core-switch.tsx +++ b/src/components/setting/mods/core-switch.tsx @@ -4,7 +4,6 @@ import { useLockFn } from "ahooks"; import { Menu, MenuItem } from "@mui/material"; import { Settings } from "@mui/icons-material"; import { changeClashCore, getVergeConfig } from "@/services/cmds"; -import { getVersion } from "@/services/api"; import Notice from "@/components/base/base-notice"; const VALID_CORE = [ @@ -28,8 +27,10 @@ const CoreSwitch = () => { try { await changeClashCore(core); mutate("getVergeConfig"); - mutate("getClashConfig"); - mutate("getVersion", getVersion()); + setTimeout(() => { + mutate("getClashConfig"); + mutate("getVersion"); + }, 100); setAnchorEl(null); Notice.success(`Successfully switch to ${core}`, 1000); } catch (err: any) {