perf: imporve clash mode switching performance on the main window (#2667)

This commit is contained in:
Tunglies
2025-02-09 07:45:46 +08:00
committed by GitHub
parent a3d0a38b1e
commit ebe0899eb1
5 changed files with 13 additions and 3 deletions

View File

@@ -4,7 +4,7 @@ import { useLockFn } from "ahooks";
import { useTranslation } from "react-i18next";
import { Box, Button, ButtonGroup } from "@mui/material";
import { closeAllConnections, getClashConfig } from "@/services/api";
import { patchClashConfig } from "@/services/cmds";
import { patchClashConfig, patchClashMode } from "@/services/cmds";
import { useVerge } from "@/hooks/use-verge";
import { BasePage } from "@/components/base";
import { ProxyGroups } from "@/components/proxy/proxy-groups";
@@ -29,7 +29,7 @@ const ProxyPage = () => {
if (mode !== curMode && verge?.auto_close_connection) {
closeAllConnections();
}
await patchClashConfig({ mode });
await patchClashMode(mode);
mutateClash();
});