Skip to content

Commit

Permalink
fix(proxy): dont hideUnAvailableProxies in proxy providers
Browse files Browse the repository at this point in the history
  • Loading branch information
kunish committed Sep 16, 2023
1 parent fa9ea90 commit be6edd9
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 17 deletions.
4 changes: 1 addition & 3 deletions src/pages/Config.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -291,9 +291,7 @@ const ConfigForXd = () => {
{
label: t('autoSwitchTheme'),
value: autoSwitchTheme,
onChange: (value: boolean) => {
setAutoSwitchTheme(value)
},
onChange: (value: boolean) => setAutoSwitchTheme(value),
subChild: autoSwitchThemeSubChild,
},
{
Expand Down
28 changes: 14 additions & 14 deletions src/pages/Proxies.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -154,14 +154,16 @@ export default () => {
<div class="grid grid-cols-1 place-items-start gap-2 sm:grid-cols-2">
<For each={proxies()}>
{(proxy) => {
const sortedProxyNames = filterProxiesByAvailability(
sortProxiesByOrderingType(
proxy.all ?? [],
const sortedProxyNames = createMemo(() =>
filterProxiesByAvailability(
sortProxiesByOrderingType(
proxy.all ?? [],
latencyMap(),
proxiesOrderingType(),
),
latencyMap(),
proxiesOrderingType(),
hideUnAvailableProxies(),
),
latencyMap(),
hideUnAvailableProxies(),
)

const title = (
Expand Down Expand Up @@ -192,7 +194,7 @@ export default () => {

<Show when={!collapsedMap()[proxy.name]}>
<ProxyNodePreview
proxyNameList={sortedProxyNames}
proxyNameList={sortedProxyNames()}
now={proxy.now}
/>
</Show>
Expand All @@ -206,7 +208,7 @@ export default () => {
onCollapse={(val) => setCollapsedMap(proxy.name, val)}
>
<ProxyCardGroups
proxyNames={sortedProxyNames}
proxyNames={sortedProxyNames()}
now={proxy.now}
onClick={(name) => void onProxyNodeClick(proxy, name)}
/>
Expand All @@ -221,14 +223,12 @@ export default () => {
<div class="grid grid-cols-1 place-items-start gap-2 sm:grid-cols-2">
<For each={proxyProviders()}>
{(proxyProvider) => {
const sortedProxyNames = filterProxiesByAvailability(
const sortedProxyNames = createMemo(() =>
sortProxiesByOrderingType(
proxyProvider.proxies.map((i) => i.name) ?? [],
latencyMap(),
proxiesOrderingType(),
),
latencyMap(),
hideUnAvailableProxies(),
)

const title = (
Expand Down Expand Up @@ -284,7 +284,7 @@ export default () => {
</div>

<Show when={!collapsedMap()[proxyProvider.name]}>
<ProxyNodePreview proxyNameList={sortedProxyNames} />
<ProxyNodePreview proxyNameList={sortedProxyNames()} />
</Show>
</>
)
Expand All @@ -297,7 +297,7 @@ export default () => {
setCollapsedMap(proxyProvider.name, val)
}
>
<ProxyCardGroups proxyNames={sortedProxyNames} />
<ProxyCardGroups proxyNames={sortedProxyNames()} />
</Collapse>
)
}}
Expand Down

1 comment on commit be6edd9

@JeelsBoobz
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't hide Proxy-Groups if Hide Unavailable Proxy

Please sign in to comment.