feat(proxy-groups, current-proxy-card): auto-refresh delay sorting

- proxy-groups: recalculate active group head and reapply delay sort after tests so list reorders automatically when "按延迟排序" is active.
- current-proxy-card: add delaySortRefresh trigger after auto/manual latency checks to immediately refresh selector and proxy list ordering.
- current-proxy-card: listen for delaySortRefresh to keep displayed delay chips and option ordering aligned with latest measurements.
This commit is contained in:
Slinetrac
2025-10-14 20:13:04 +08:00
parent 7c71d07ad2
commit 2e3174baa7
3 changed files with 60 additions and 40 deletions

View File

@@ -80,6 +80,16 @@ export const ProxyGroups = (props: Props) => {
selectedGroup,
);
const getGroupHeadState = useCallback(
(groupName: string) => {
const headItem = renderList.find(
(item) => item.type === 1 && item.group?.name === groupName,
);
return headItem?.headState;
},
[renderList],
);
// 统代理选择
const { handleProxyGroupChange } = useProxySelection({
onSuccess: () => {
@@ -297,9 +307,13 @@ export const ProxyGroups = (props: Props) => {
console.log(`[ProxyGroups] 延迟测试完成,组: ${groupName}`);
} catch (error) {
console.error(`[ProxyGroups] 延迟测试出错,组: ${groupName}`, error);
} finally {
const headState = getGroupHeadState(groupName);
if (headState?.sortType === 1) {
onHeadState(groupName, { sortType: headState.sortType });
}
onProxies();
}
onProxies();
});
// 滚到对应的节点