mirror of
https://github.com/clash-verge-rev/clash-verge-rev.git
synced 2026-11-05 16:22:08 +08:00
fix(proxy): revalidate proxy view when expanding a group
Badge values for freshly expanded rows seed from the cached proxy view. Results that reach the core without a frontend event (tray group test, provider health checks) are absent from that snapshot until the next poll, so measured delays only appeared after another interaction such as switching nodes forced a refetch. Route head state patches through a wrapper that revalidates the view on open transitions, matching how the group test already refreshes.
This commit is contained in:
@@ -44,6 +44,7 @@ import {
|
||||
ProxyGroupNavigator,
|
||||
} from './proxy-group-navigator'
|
||||
import { ProxyRender } from './proxy-render'
|
||||
import type { HeadState } from './use-head-state'
|
||||
import {
|
||||
PROXY_GROUP_HEADER_SENSORS,
|
||||
useProxyGroupHeaderLayout,
|
||||
@@ -90,11 +91,11 @@ function useProxyRenderState(
|
||||
) {
|
||||
const { verge } = useVerge()
|
||||
const { proxyView } = useProxiesData()
|
||||
const { renderList, onProxies, onHeadState } = useRenderList(
|
||||
mode,
|
||||
isChainMode,
|
||||
activeSelectedGroup,
|
||||
)
|
||||
const {
|
||||
renderList,
|
||||
onProxies,
|
||||
onHeadState: setListHeadState,
|
||||
} = useRenderList(mode, isChainMode, activeSelectedGroup)
|
||||
const scrollPositionKey = useMemo(
|
||||
() =>
|
||||
isChainMode
|
||||
@@ -103,6 +104,14 @@ function useProxyRenderState(
|
||||
[activeSelectedGroup, isChainMode, mode],
|
||||
)
|
||||
|
||||
const onHeadState = useCallback(
|
||||
(groupName: string, patch: Partial<HeadState>) => {
|
||||
if (patch.open) onProxies()
|
||||
setListHeadState(groupName, patch)
|
||||
},
|
||||
[onProxies, setListHeadState],
|
||||
)
|
||||
|
||||
const timeout = verge?.default_latency_timeout || 10000
|
||||
|
||||
const handleCheckAll = useStableCallback(
|
||||
|
||||
Reference in New Issue
Block a user