refactor: replace useSWR with custom hooks for update and network interfaces (#6195)

This commit is contained in:
Tunglies
2026-01-27 12:52:20 +00:00
committed by GitHub
parent 36926df26c
commit c57a962109
8 changed files with 97 additions and 69 deletions
+2 -10
View File
@@ -1,9 +1,8 @@
import { useEffect, useMemo } from "react";
import useSWR from "swr";
import { useRuntimeConfig } from "@/hooks/use-clash";
import { useVerge } from "@/hooks/use-verge";
import { useAppData } from "@/providers/app-data-context";
import { getRuntimeConfig } from "@/services/cmds";
import delayManager from "@/services/delay";
import { debugLog } from "@/utils/debug";
@@ -107,14 +106,7 @@ export const useRenderList = (
const latencyTimeout = verge?.default_latency_timeout;
// 获取运行时配置用于链式代理模式
const { data: runtimeConfig } = useSWR(
isChainMode ? "getRuntimeConfig" : null,
getRuntimeConfig,
{
revalidateOnFocus: false,
revalidateIfStale: true,
},
);
const { data: runtimeConfig } = useRuntimeConfig(!!isChainMode);
// 计算列数
const col = useMemo(