fix: app freeze when core run by service mode and open app window (#4922)

* fix: app freeze when core run by service mode

* chore: update

* chore: update UPDATELOG

---------

Co-authored-by: Tunglies <77394545+Tunglies@users.noreply.github.com>
This commit is contained in:
oomeow
2025-10-04 20:44:49 +08:00
committed by GitHub
parent 600b0b52f4
commit 90b98f695b
3 changed files with 35 additions and 26 deletions

View File

@@ -8,7 +8,7 @@ import { showNotice } from "@/services/noticeService";
export const useVerge = () => {
const { t } = useTranslation();
const { isTunModeAvailable } = useSystemState();
const { isTunModeAvailable, isLoading } = useSystemState();
const { data: verge, mutate: mutateVerge } = useSWR(
"getVergeConfig",
@@ -27,7 +27,7 @@ export const useVerge = () => {
// 当服务不可用且TUN模式开启时自动关闭TUN
useEffect(() => {
if (enable_tun_mode && !isTunModeAvailable) {
if (enable_tun_mode && !isTunModeAvailable && !isLoading) {
console.log("[useVerge] 检测到服务不可用自动关闭TUN模式");
patchVergeConfig({ enable_tun_mode: false })
@@ -43,7 +43,7 @@ export const useVerge = () => {
showNotice("error", t("Failed to disable TUN Mode automatically"));
});
}
}, [isTunModeAvailable, enable_tun_mode, mutateVerge, t]);
}, [isTunModeAvailable, isLoading, enable_tun_mode, mutateVerge, t]);
return {
verge,