fix: restart clash core after change it

This commit is contained in:
wonfen
2025-04-19 22:23:58 +08:00
parent 05b910dc17
commit 541b78ba6f
2 changed files with 23 additions and 7 deletions

View File

@@ -45,13 +45,18 @@ export const ClashCoreViewer = forwardRef<DialogRef>((props, ref) => {
try {
closeAllConnections();
await changeClashCore(core);
const errorMsg = await changeClashCore(core);
if (errorMsg) {
Notice.error(errorMsg);
return;
}
mutateVerge();
setTimeout(() => {
mutate("getClashConfig");
mutate("getVersion");
}, 100);
// Notice.success(t("Switched to _clash Core", { core: `${core}` }), 1000);
}, 500);
} catch (err: any) {
Notice.error(err?.message || err.toString());
}