fix: resolve freeze issue caused by rapid "Proxy Mode" switching on homepage

This commit is contained in:
wonfen
2025-04-10 11:34:27 +08:00
parent 843f40d7d5
commit 5fcea4c684
6 changed files with 18 additions and 6 deletions

View File

@@ -15,7 +15,7 @@ import { useAppData } from "@/providers/app-data-provider";
export const ClashModeCard = () => {
const { t } = useTranslation();
const { verge } = useVerge();
const { clashConfig, refreshProxy } = useAppData();
const { clashConfig, refreshClashConfig } = useAppData();
// 支持的模式列表
const modeList = useMemo(() => ["rule", "global", "direct"] as const, []);
@@ -40,7 +40,7 @@ export const ClashModeCard = () => {
try {
await patchClashMode(mode);
// 使用共享的刷新方法
refreshProxy();
refreshClashConfig();
} catch (error) {
console.error("Failed to change mode:", error);
}