fix: defer provider queries on startup

This commit is contained in:
Tunglies
2026-06-29 06:03:51 +08:00
parent 2a5d29cdb2
commit 4ec3a9bf4c
3 changed files with 10 additions and 1 deletions
+5 -1
View File
@@ -18,7 +18,7 @@ import {
} from '@mui/material'
import { useLockFn } from 'ahooks'
import dayjs from 'dayjs'
import { useState } from 'react'
import { useEffect, useState } from 'react'
import { useTranslation } from 'react-i18next'
import { updateProxyProvider } from 'tauri-plugin-mihomo-api'
@@ -52,6 +52,10 @@ export const ProviderButton = () => {
const { refreshProxy, refreshProxyProviders } = useAppRefreshers()
const [updating, setUpdating] = useState<Record<string, boolean>>({})
useEffect(() => {
refreshProxyProviders().catch(() => {})
}, [refreshProxyProviders])
// 检查是否有提供者
const hasProviders = Object.keys(proxyProviders || {}).length > 0