Skip to content

Commit 73c2e53

Browse files
committed
simply: comment fetch trafficData and memoryData.
1 parent 2e36295 commit 73c2e53

File tree

1 file changed

+38
-38
lines changed

1 file changed

+38
-38
lines changed

src/providers/app-data-provider.tsx

Lines changed: 38 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ import {
1414
getProxyProviders,
1515
getRuleProviders,
1616
getConnections,
17-
getTrafficData,
18-
getMemoryData,
17+
// getTrafficData,
18+
// getMemoryData,
1919
} from "@/services/cmds";
2020
import {
2121
getSystemProxy,
@@ -56,8 +56,8 @@ interface AppDataContextType {
5656
uploadTotal: number;
5757
downloadTotal: number;
5858
};
59-
traffic: { up: number; down: number };
60-
memory: { inuse: number };
59+
// traffic: { up: number; down: number };
60+
// memory: { inuse: number };
6161
systemProxyAddress: string;
6262

6363
refreshProxy: () => Promise<any>;
@@ -449,36 +449,36 @@ export const AppDataProvider = ({
449449
},
450450
);
451451

452-
// 流量数据 - 使用IPC轮询更新
453-
const { data: trafficData = { up: 0, down: 0 } } = useSWR(
454-
clashInfo && pageVisible ? "getTrafficData" : null,
455-
getTrafficData,
456-
{
457-
refreshInterval: 1000, // 1秒刷新一次
458-
fallbackData: { up: 0, down: 0 },
459-
keepPreviousData: true,
460-
onSuccess: () => {
461-
// console.log("[Traffic][AppDataProvider] IPC 获取到流量数据:", data);
462-
},
463-
onError: (error) => {
464-
console.error("[Traffic][AppDataProvider] IPC 获取数据错误:", error);
465-
},
466-
},
467-
);
468-
469-
// 内存数据 - 使用IPC轮询更新
470-
const { data: memoryData = { inuse: 0 } } = useSWR(
471-
clashInfo && pageVisible ? "getMemoryData" : null,
472-
getMemoryData,
473-
{
474-
refreshInterval: 2000, // 2秒刷新一次
475-
fallbackData: { inuse: 0 },
476-
keepPreviousData: true,
477-
onError: (error) => {
478-
console.error("[Memory] IPC 获取数据错误:", error);
479-
},
480-
},
481-
);
452+
// // 流量数据 - 使用IPC轮询更新
453+
// const { data: trafficData = { up: 0, down: 0 } } = useSWR(
454+
// clashInfo && pageVisible ? "getTrafficData" : null,
455+
// getTrafficData,
456+
// {
457+
// refreshInterval: 1000, // 1秒刷新一次
458+
// fallbackData: { up: 0, down: 0 },
459+
// keepPreviousData: true,
460+
// onSuccess: () => {
461+
// // console.log("[Traffic][AppDataProvider] IPC 获取到流量数据:", data);
462+
// },
463+
// onError: (error) => {
464+
// console.error("[Traffic][AppDataProvider] IPC 获取数据错误:", error);
465+
// },
466+
// },
467+
// );
468+
469+
// // 内存数据 - 使用IPC轮询更新
470+
// const { data: memoryData = { inuse: 0 } } = useSWR(
471+
// clashInfo && pageVisible ? "getMemoryData" : null,
472+
// getMemoryData,
473+
// {
474+
// refreshInterval: 2000, // 2秒刷新一次
475+
// fallbackData: { inuse: 0 },
476+
// keepPreviousData: true,
477+
// onError: (error) => {
478+
// console.error("[Memory] IPC 获取数据错误:", error);
479+
// },
480+
// },
481+
// );
482482

483483
// 提供统一的刷新方法
484484
const refreshAll = async () => {
@@ -547,8 +547,8 @@ export const AppDataProvider = ({
547547
},
548548

549549
// 实时流量数据
550-
traffic: trafficData,
551-
memory: memoryData,
550+
// traffic: trafficData,
551+
// memory: memoryData,
552552

553553
systemProxyAddress: calculateSystemProxyAddress(),
554554

@@ -569,8 +569,8 @@ export const AppDataProvider = ({
569569
runningMode,
570570
uptimeData,
571571
connectionsData,
572-
trafficData,
573-
memoryData,
572+
// trafficData,
573+
// memoryData,
574574
proxyProviders,
575575
ruleProviders,
576576
verge,

0 commit comments

Comments
 (0)