From fa3007d3a4b42f3432e181c3691b3d241e92f84c Mon Sep 17 00:00:00 2001 From: TonyWu <75903587+TonyWu2333@users.noreply.github.com> Date: Tue, 17 Nov 2026 10:37:27 +0000 Subject: [PATCH] fix(proxy): keep subscription order in chain proxy mode (#8391) Since #7542 the global chain list follows the proxy view's standalone records, which are name-sorted, and the runtime config's proxies array is only used as a membership filter. Walk that array in order instead so the list matches the subscription order again. Fixes #8381 --- Changelog.md | 1 + src/types/proxy-view.ts | 19 ++++++++++--------- 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/Changelog.md b/Changelog.md index 169d196d4..63ed7e099 100644 --- a/Changelog.md +++ b/Changelog.md @@ -37,6 +37,7 @@ - 修复断开链式代理时清空已选节点,导致再次连接需要重新选择 - 修复「连接」页表格排序时表头换行、标题位置跳动 - 修复「TUN 设置」未手动保存时,界面显示的默认 MTU 1500 未生效 +- 修复「链式代理」节点列表按名称排序,未保持订阅中的节点顺序 **🍎 macOS** diff --git a/src/types/proxy-view.ts b/src/types/proxy-view.ts index d65b1fa89..cebd34f4f 100644 --- a/src/types/proxy-view.ts +++ b/src/types/proxy-view.ts @@ -120,19 +120,20 @@ const selectRuntimeStandaloneNodes = ( view: ProxyViewV1, runtimeProxies: unknown, ) => { - const runtimeProxyNames = new Set( - (Array.isArray(runtimeProxies) ? runtimeProxies : []).flatMap((proxy) => { + const coreNodes = new Map( + resolveStandaloneNodes(view).flatMap((node) => + node.source.kind === 'core' ? [[node.source.proxyName, node]] : [], + ), + ) + return (Array.isArray(runtimeProxies) ? runtimeProxies : []).flatMap( + (proxy) => { const name = typeof proxy === 'object' && proxy !== null && 'name' in proxy ? proxy.name : undefined - return typeof name === 'string' && name.length > 0 ? [name] : [] - }), - ) - return resolveStandaloneNodes(view).filter( - (node) => - node.source.kind === 'core' && - runtimeProxyNames.has(node.source.proxyName), + const node = typeof name === 'string' ? coreNodes.get(name) : undefined + return node ? [node] : [] + }, ) }