mirror of
https://github.com/clash-verge-rev/clash-verge-rev.git
synced 2026-10-30 10:42:09 +08:00
fix: update tauri-plugin-mihomo version, improve error handling #6149
This commit is contained in:
+14
-2
@@ -23,8 +23,8 @@ import {
|
||||
} from "@mui/material";
|
||||
import dayjs from "dayjs";
|
||||
import relativeTime from "dayjs/plugin/relativeTime";
|
||||
import { useCallback, useEffect, useMemo, useRef, useState } from "react";
|
||||
import type { CSSProperties } from "react";
|
||||
import { useCallback, useEffect, useMemo, useRef, useState } from "react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { Outlet, useNavigate } from "react-router";
|
||||
import { SWRConfig } from "swr";
|
||||
@@ -257,12 +257,24 @@ const Layout = () => {
|
||||
<SWRConfig
|
||||
value={{
|
||||
errorRetryCount: 3,
|
||||
// TODO remove the 5000ms
|
||||
errorRetryInterval: 5000,
|
||||
onError: (error, key) => {
|
||||
console.error(`[SWR Error] Key: ${key}, Error:`, error);
|
||||
// FIXME the condition should not be handle gllobally
|
||||
if (key !== "getAutotemProxy") {
|
||||
console.error(`SWR Error for ${key}:`, error);
|
||||
return;
|
||||
}
|
||||
|
||||
// FIXME we need a better way to handle the retry when first booting app
|
||||
const silentKeys = [
|
||||
"getVersion",
|
||||
"getClashConfig",
|
||||
"getAutotemProxy",
|
||||
];
|
||||
if (silentKeys.includes(key)) return;
|
||||
|
||||
console.error(`[SWR Error] Key: ${key}, Error:`, error);
|
||||
},
|
||||
dedupingInterval: 2000,
|
||||
}}
|
||||
|
||||
@@ -32,7 +32,11 @@ export const AppDataProvider = ({
|
||||
calcuProxies,
|
||||
{
|
||||
...SWR_REALTIME,
|
||||
onError: (err) => console.warn("[DataProvider] Proxy fetch failed:", err),
|
||||
onError: (_) => {
|
||||
// FIXME when we intially start the app, and core is starting,
|
||||
// there will be error thrown by getProxies API.
|
||||
// We should handle this case properly later.
|
||||
},
|
||||
},
|
||||
);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user