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

View File

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

View File

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