From be6edd914a32b05125337fd113d571f6066b0265 Mon Sep 17 00:00:00 2001 From: kunish Date: Sat, 16 Sep 2023 14:28:21 +0800 Subject: [PATCH] fix(proxy): dont hideUnAvailableProxies in proxy providers --- src/pages/Config.tsx | 4 +--- src/pages/Proxies.tsx | 28 ++++++++++++++-------------- 2 files changed, 15 insertions(+), 17 deletions(-) diff --git a/src/pages/Config.tsx b/src/pages/Config.tsx index a722ee5..1464948 100644 --- a/src/pages/Config.tsx +++ b/src/pages/Config.tsx @@ -291,9 +291,7 @@ const ConfigForXd = () => { { label: t('autoSwitchTheme'), value: autoSwitchTheme, - onChange: (value: boolean) => { - setAutoSwitchTheme(value) - }, + onChange: (value: boolean) => setAutoSwitchTheme(value), subChild: autoSwitchThemeSubChild, }, { diff --git a/src/pages/Proxies.tsx b/src/pages/Proxies.tsx index 446897d..07c371d 100644 --- a/src/pages/Proxies.tsx +++ b/src/pages/Proxies.tsx @@ -4,7 +4,7 @@ import { IconReload, IconSettings, } from '@tabler/icons-solidjs' -import { For, Show, createSignal } from 'solid-js' +import { For, Show, createMemo, createSignal } from 'solid-js' import { twMerge } from 'tailwind-merge' import { Button, @@ -154,14 +154,16 @@ export default () => {
{(proxy) => { - const sortedProxyNames = filterProxiesByAvailability( - sortProxiesByOrderingType( - proxy.all ?? [], + const sortedProxyNames = createMemo(() => + filterProxiesByAvailability( + sortProxiesByOrderingType( + proxy.all ?? [], + latencyMap(), + proxiesOrderingType(), + ), latencyMap(), - proxiesOrderingType(), + hideUnAvailableProxies(), ), - latencyMap(), - hideUnAvailableProxies(), ) const title = ( @@ -192,7 +194,7 @@ export default () => { @@ -206,7 +208,7 @@ export default () => { onCollapse={(val) => setCollapsedMap(proxy.name, val)} > void onProxyNodeClick(proxy, name)} /> @@ -221,14 +223,12 @@ export default () => {
{(proxyProvider) => { - const sortedProxyNames = filterProxiesByAvailability( + const sortedProxyNames = createMemo(() => sortProxiesByOrderingType( proxyProvider.proxies.map((i) => i.name) ?? [], latencyMap(), proxiesOrderingType(), ), - latencyMap(), - hideUnAvailableProxies(), ) const title = ( @@ -284,7 +284,7 @@ export default () => {
- + ) @@ -297,7 +297,7 @@ export default () => { setCollapsedMap(proxyProvider.name, val) } > - + ) }}