fix(proxy): fetch proxies after latency test

This commit is contained in:
kunish 2023-09-24 15:29:26 +08:00
parent 355b237387
commit 81fe550912
No known key found for this signature in database
GPG Key ID: 647A12B4F782C430
3 changed files with 7 additions and 8 deletions

View File

@ -15,7 +15,6 @@ import {
favNightTheme,
setCurTheme,
setLatestConnectionMsg,
useProxies,
useTwemoji,
useWsRequest,
} from '~/signals'
@ -29,10 +28,6 @@ const Rules = lazy(() => import('~/pages/Rules'))
const Config = lazy(() => import('~/pages/Config'))
const ProtectedResources = () => {
const { fetchProxies } = useProxies()
onMount(fetchProxies)
const latestConnectionMsg = useWsRequest<WsMsg>('connections')
createEffect(() => {

View File

@ -3,7 +3,7 @@ import {
IconReload,
IconSettings,
} from '@tabler/icons-solidjs'
import { For, Show, createMemo, createSignal } from 'solid-js'
import { For, Show, createMemo, createSignal, onMount } from 'solid-js'
import { twMerge } from 'tailwind-merge'
import {
Button,
@ -38,6 +38,7 @@ export default () => {
const [t] = useI18n()
const {
fetchProxies,
proxies,
selectProxyInGroup,
latencyTestByProxyGroupName,
@ -48,6 +49,8 @@ export default () => {
healthCheckByProviderName,
} = useProxies()
onMount(fetchProxies)
const { map: collapsedMap, set: setCollapsedMap } = useStringBooleanMap()
const { map: latencyTestingMap, setWithCallback: setLatencyTestingMap } =
useStringBooleanMap()
@ -100,7 +103,7 @@ export default () => {
return (
<div class="flex h-full flex-col gap-2">
<div class="flex items-center gap-2">
<div class="tabs tabs-boxed gap-2">
<div class="tabs-boxed tabs gap-2">
<For each={tabs()}>
{(tab) => (
<button

View File

@ -120,11 +120,12 @@ export const useProxies = () => {
latencyTestTimeoutDuration(),
)
await fetchProxies()
setLatencyMap({
...latencyMap(),
...data,
})
await fetchProxies()
}
const updateProviderByProviderName = async (providerName: string) => {