refactor: optimize swr data refresh paths

This commit is contained in:
Tunglies
2026-06-28 19:42:21 +08:00
parent e71e701fd0
commit b9da0875cd
16 changed files with 153 additions and 162 deletions
+2 -2
View File
@@ -3,7 +3,7 @@ import { useEffect, useRef } from 'react'
import { MihomoWebSocket, type LogLevel } from 'tauri-plugin-mihomo-api'
import { getClashLogs } from '@/services/cmds'
import { queryClient } from '@/services/query-client'
import { setCacheData } from '@/services/query-client'
import { useClashLog } from './use-clash-log'
import { useMihomoWsSubscription } from './use-mihomo-ws-subscription'
@@ -155,7 +155,7 @@ export const useLogData = () => {
const refreshGetClashLog = (clear = false) => {
if (clear) {
if (subscriptionCacheKey) {
queryClient.setQueryData<ILogItem[]>([subscriptionCacheKey], [])
setCacheData<ILogItem[]>([subscriptionCacheKey], [])
}
} else {
hasLoadedInitialLogsRef.current = false