mirror of
https://github.com/clash-verge-rev/clash-verge-rev.git
synced 2026-10-25 13:12:07 +08:00
fix: eliminate error flash on startup by distinguishing loading from error state
- Change TQ_MIHOMO retryDelay from fixed 2000ms to exponential backoff (200ms → 400ms → 800ms, cap 3s) so core-dependent queries retry faster - Expose isCoreDataPending from AppDataProvider to distinguish between data still loading vs actual errors - ClashModeCard: show placeholder instead of "communication error" while core data is pending - CurrentProxyCard: show empty space instead of "no active node" while core data is pending
This commit is contained in:
@@ -41,7 +41,7 @@ const MODE_META: Record<
|
||||
export const ClashModeCard = () => {
|
||||
const { t } = useTranslation()
|
||||
const { verge } = useVerge()
|
||||
const { clashConfig, refreshClashConfig } = useAppData()
|
||||
const { clashConfig, isCoreDataPending, refreshClashConfig } = useAppData()
|
||||
|
||||
// 支持的模式列表
|
||||
const modeList = CLASH_MODES
|
||||
@@ -57,8 +57,11 @@ export const ClashModeCard = () => {
|
||||
if (currentModeKey) {
|
||||
return t(MODE_META[currentModeKey].description)
|
||||
}
|
||||
if (isCoreDataPending) {
|
||||
return '\u00A0'
|
||||
}
|
||||
return t('home.components.clashMode.errors.communication')
|
||||
}, [currentModeKey, t])
|
||||
}, [currentModeKey, isCoreDataPending, t])
|
||||
|
||||
// 模式图标映射
|
||||
const modeIcons = useMemo(
|
||||
|
||||
@@ -105,7 +105,8 @@ export const CurrentProxyCard = () => {
|
||||
const { t } = useTranslation()
|
||||
const navigate = useNavigate()
|
||||
const theme = useTheme()
|
||||
const { proxies, clashConfig, refreshProxy, rules } = useAppData()
|
||||
const { proxies, clashConfig, isCoreDataPending, refreshProxy, rules } =
|
||||
useAppData()
|
||||
const { verge } = useVerge()
|
||||
const { current: currentProfile } = useProfiles()
|
||||
const autoDelayEnabled = verge?.enable_auto_delay_detection ?? false
|
||||
@@ -911,7 +912,9 @@ export const CurrentProxyCard = () => {
|
||||
</Box>
|
||||
}
|
||||
>
|
||||
{currentProxy ? (
|
||||
{isCoreDataPending ? (
|
||||
<Box sx={{ py: 4 }} />
|
||||
) : currentProxy ? (
|
||||
<Box>
|
||||
{/* 代理节点信息显示 */}
|
||||
<Box
|
||||
|
||||
Reference in New Issue
Block a user