diff options
| author | Matain <[email protected]> | 2022-06-08 23:40:42 +0800 |
|---|---|---|
| committer | Matain <[email protected]> | 2022-06-08 23:40:42 +0800 |
| commit | 68c6be4359f3b37fe71d89357f581567ecd40e12 (patch) | |
| tree | 0765d3f0215f593bc2bfcc0421ba1171204058f2 /src/components | |
| parent | 91bfabd5d231df21003f09f49e897b9a5bfc57d7 (diff) | |
add the groupproxy delay test(maybe a little question)
Diffstat (limited to 'src/components')
| -rw-r--r-- | src/components/proxies/ProxyGroup.tsx | 19 |
1 files changed, 8 insertions, 11 deletions
diff --git a/src/components/proxies/ProxyGroup.tsx b/src/components/proxies/ProxyGroup.tsx index c835d7e..49ba2e7 100644 --- a/src/components/proxies/ProxyGroup.tsx +++ b/src/components/proxies/ProxyGroup.tsx @@ -1,12 +1,10 @@ import * as React from 'react'; import { Zap } from 'react-feather'; -import { - getCollapsibleIsOpen, - getHideUnavailableProxies, - getProxySortBy, -} from '../../store/app'; -import { getProxies, switchProxy } from '../../store/proxies'; +import * as proxiesAPI from '$src/api/proxies'; +import { getCollapsibleIsOpen, getHideUnavailableProxies, getProxySortBy } from '$src/store/app'; +import { getProxies, switchProxy } from '$src/store/proxies'; + import Button from '../Button'; import CollapsibleSectionHeader from '../CollapsibleSectionHeader'; import { connect, useStoreActions } from '../StateProvider'; @@ -14,6 +12,7 @@ import { useFilteredAndSorted } from './hooks'; import s0 from './ProxyGroup.module.scss'; import { ProxyList, ProxyListSummaryView } from './ProxyList'; + const { createElement, useCallback, useMemo, useState } = React; function ZapWrapper() { @@ -46,10 +45,9 @@ function ProxyGroupImpl({ ); const isSelectable = useMemo(() => ['Selector', 'Fallback'].includes(type) , [type]); - const { app: { updateCollapsibleIsOpen }, - proxies: { requestDelayForProxies }, + // proxies: { requestDelayForProxyGroup }, } = useStoreActions(); const toggle = useCallback(() => { @@ -63,15 +61,14 @@ function ProxyGroupImpl({ }, [apiConfig, dispatch, name, isSelectable] ); - const [isTestingLatency, setIsTestingLatency] = useState(false); const testLatency = useCallback(async () => { setIsTestingLatency(true); try { - await requestDelayForProxies(apiConfig, all); + await proxiesAPI.requestDelayForProxyGroup(apiConfig,name); } catch (err) {} setIsTestingLatency(false); - }, [all, apiConfig, requestDelayForProxies]); + }, [apiConfig, name]); return ( <div className={s0.group}> |
