refactor: migrate SWR to TanStack Query v5 (#6713)

Replace swr with @tanstack/react-query v5 across all hooks, providers,
and components. Introduce singleton QueryClient, WS subscription pattern
via useQuery+useEffect, and enforce component-layer cache access contract.
This commit is contained in:
Tunglies
2026-04-03 08:15:51 +00:00
committed by GitHub
parent 6f4ddb6db3
commit a73fafaf9f
27 changed files with 745 additions and 590 deletions
@@ -1,6 +1,5 @@
import React, { useRef } from 'react'
import { useTranslation } from 'react-i18next'
import { mutate } from 'swr'
import { DialogRef, Switch, TooltipIcon } from '@/components/base'
import ProxyControlSwitches from '@/components/shared/proxy-control-switches'
@@ -62,7 +61,6 @@ const SettingSystem = ({ onError }: Props) => {
// 先触发UI更新立即看到反馈
onChangeData({ enable_auto_launch: e })
await patchVerge({ enable_auto_launch: e })
await mutate('getAutoLaunchStatus')
return Promise.resolve()
} catch (error) {
// 如果出错,恢复原始状态