fix(proxy): dont hideUnAvailableProxies in proxy providers

This commit is contained in:
kunish 2023-09-16 14:28:21 +08:00
parent fa9ea90bce
commit be6edd914a
No known key found for this signature in database
GPG Key ID: 647A12B4F782C430
2 changed files with 15 additions and 17 deletions

View File

@ -291,9 +291,7 @@ const ConfigForXd = () => {
{ {
label: t('autoSwitchTheme'), label: t('autoSwitchTheme'),
value: autoSwitchTheme, value: autoSwitchTheme,
onChange: (value: boolean) => { onChange: (value: boolean) => setAutoSwitchTheme(value),
setAutoSwitchTheme(value)
},
subChild: autoSwitchThemeSubChild, subChild: autoSwitchThemeSubChild,
}, },
{ {

View File

@ -4,7 +4,7 @@ import {
IconReload, IconReload,
IconSettings, IconSettings,
} from '@tabler/icons-solidjs' } 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 { twMerge } from 'tailwind-merge'
import { import {
Button, Button,
@ -154,14 +154,16 @@ export default () => {
<div class="grid grid-cols-1 place-items-start gap-2 sm:grid-cols-2"> <div class="grid grid-cols-1 place-items-start gap-2 sm:grid-cols-2">
<For each={proxies()}> <For each={proxies()}>
{(proxy) => { {(proxy) => {
const sortedProxyNames = filterProxiesByAvailability( const sortedProxyNames = createMemo(() =>
sortProxiesByOrderingType( filterProxiesByAvailability(
proxy.all ?? [], sortProxiesByOrderingType(
proxy.all ?? [],
latencyMap(),
proxiesOrderingType(),
),
latencyMap(), latencyMap(),
proxiesOrderingType(), hideUnAvailableProxies(),
), ),
latencyMap(),
hideUnAvailableProxies(),
) )
const title = ( const title = (
@ -192,7 +194,7 @@ export default () => {
<Show when={!collapsedMap()[proxy.name]}> <Show when={!collapsedMap()[proxy.name]}>
<ProxyNodePreview <ProxyNodePreview
proxyNameList={sortedProxyNames} proxyNameList={sortedProxyNames()}
now={proxy.now} now={proxy.now}
/> />
</Show> </Show>
@ -206,7 +208,7 @@ export default () => {
onCollapse={(val) => setCollapsedMap(proxy.name, val)} onCollapse={(val) => setCollapsedMap(proxy.name, val)}
> >
<ProxyCardGroups <ProxyCardGroups
proxyNames={sortedProxyNames} proxyNames={sortedProxyNames()}
now={proxy.now} now={proxy.now}
onClick={(name) => void onProxyNodeClick(proxy, name)} onClick={(name) => void onProxyNodeClick(proxy, name)}
/> />
@ -221,14 +223,12 @@ export default () => {
<div class="grid grid-cols-1 place-items-start gap-2 sm:grid-cols-2"> <div class="grid grid-cols-1 place-items-start gap-2 sm:grid-cols-2">
<For each={proxyProviders()}> <For each={proxyProviders()}>
{(proxyProvider) => { {(proxyProvider) => {
const sortedProxyNames = filterProxiesByAvailability( const sortedProxyNames = createMemo(() =>
sortProxiesByOrderingType( sortProxiesByOrderingType(
proxyProvider.proxies.map((i) => i.name) ?? [], proxyProvider.proxies.map((i) => i.name) ?? [],
latencyMap(), latencyMap(),
proxiesOrderingType(), proxiesOrderingType(),
), ),
latencyMap(),
hideUnAvailableProxies(),
) )
const title = ( const title = (
@ -284,7 +284,7 @@ export default () => {
</div> </div>
<Show when={!collapsedMap()[proxyProvider.name]}> <Show when={!collapsedMap()[proxyProvider.name]}>
<ProxyNodePreview proxyNameList={sortedProxyNames} /> <ProxyNodePreview proxyNameList={sortedProxyNames()} />
</Show> </Show>
</> </>
) )
@ -297,7 +297,7 @@ export default () => {
setCollapsedMap(proxyProvider.name, val) setCollapsedMap(proxyProvider.name, val)
} }
> >
<ProxyCardGroups proxyNames={sortedProxyNames} /> <ProxyCardGroups proxyNames={sortedProxyNames()} />
</Collapse> </Collapse>
) )
}} }}