From c848d8414e4186d2f7574466ccadbd63c9d99ba5 Mon Sep 17 00:00:00 2001 From: Haishan Date: Tue, 16 Jun 2020 00:03:16 +0800 Subject: [PATCH] fix: default to big latency for items with unavailable statistics when sorting for https://github.com/haishanh/yacd/issues/496 --- src/components/proxies/ProxyGroup.tsx | 6 +----- src/components/proxies/ProxyList.tsx | 2 -- 2 files changed, 1 insertion(+), 7 deletions(-) diff --git a/src/components/proxies/ProxyGroup.tsx b/src/components/proxies/ProxyGroup.tsx index 4dd4fac..3ee995e 100644 --- a/src/components/proxies/ProxyGroup.tsx +++ b/src/components/proxies/ProxyGroup.tsx @@ -84,13 +84,9 @@ function ProxyGroupImpl({ name, all, type, now, isOpen, apiConfig, dispatch }) { } const getSortDelay = (d, w) => { - if (d === undefined) { - return 0; - } - if (!d.error && d.number > 0) { + if (d && typeof d.number === 'number' && d.number > 0) { return d.number; } - return w; }; diff --git a/src/components/proxies/ProxyList.tsx b/src/components/proxies/ProxyList.tsx index 850d360..6a6bf15 100644 --- a/src/components/proxies/ProxyList.tsx +++ b/src/components/proxies/ProxyList.tsx @@ -1,7 +1,5 @@ import * as React from 'react'; -/* import cx from 'clsx'; */ - import { Proxy, ProxySmall } from './Proxy'; import s from './ProxyList.module.css';