mirror of
https://github.com/CrazyJasonwell/clash-verge-rev.git
synced 2026-10-20 22:58:32 +08:00
feat: display delay check result timely
This commit is contained in:
1 parent
947c38c124
commit
14f627d0d3
9 files changed
+179
-138
No files matched your search
@@ -49,6 +49,14 @@ const ProxyItem = (props: Props) => {
|
||||
// -2 为 loading
|
||||
const [delay, setDelay] = useState(-1);
|
||||
|
||||
useEffect(() => {
|
||||
delayManager.setListener(proxy.name, groupName, setDelay);
|
||||
|
||||
return () => {
|
||||
delayManager.removeListener(proxy.name, groupName);
|
||||
};
|
||||
}, [proxy.name, groupName]);
|
||||
|
||||
useEffect(() => {
|
||||
if (!proxy) return;
|
||||
|
||||
@@ -66,10 +74,7 @@ const ProxyItem = (props: Props) => {
|
||||
|
||||
const onDelay = useLockFn(async () => {
|
||||
setDelay(-2);
|
||||
return delayManager
|
||||
.checkDelay(proxy.name, groupName)
|
||||
.then((result) => setDelay(result))
|
||||
.catch(() => setDelay(1e6));
|
||||
setDelay(await delayManager.checkDelay(proxy.name, groupName));
|
||||
});
|
||||
|
||||
return (
|
||||
|
||||
Reference in new issue
Block a user