diff --git a/Changelog.md b/Changelog.md index 94b6045e2..ee0c8c66c 100644 --- a/Changelog.md +++ b/Changelog.md @@ -3,6 +3,7 @@
🐞 修复问题 +- 修复通过 URL 导入订阅时,即使导入的订阅并非当前使用的订阅,也会重新加载当前配置的问题
diff --git a/crates/clash-verge-i18n/locales/pt.yml b/crates/clash-verge-i18n/locales/pt.yml index 2373529ee..5999d1b91 100644 --- a/crates/clash-verge-i18n/locales/pt.yml +++ b/crates/clash-verge-i18n/locales/pt.yml @@ -70,6 +70,8 @@ tray: global: Global profiles: Perfis proxies: Proxies + testLatency: Test Latency + testingLatency: Testing latency… systemProxy: Proxy do sistema tunMode: Modo TUN closeAllConnections: Fechar todas as conexões diff --git a/src/pages/profiles.tsx b/src/pages/profiles.tsx index 78c38f973..e7b243028 100644 --- a/src/pages/profiles.tsx +++ b/src/pages/profiles.tsx @@ -212,10 +212,12 @@ const ProfilePage = () => { } setLoading(true) + const prevCurrent = profiles.current + const handleImportSuccess = async (noticeKey: string) => { showNotice.success(noticeKey) setUrl('') - await performRobustRefresh() + await performRobustRefresh(prevCurrent) } try { await mutate(() => importProfile(url), { @@ -261,7 +263,7 @@ const ProfilePage = () => { } // `useProfiles` already retries three times; add only one business-level retry. - const performRobustRefresh = async () => { + const performRobustRefresh = async (prevCurrent?: string) => { let retryCount = 0 const maxRetries = 1 const baseDelay = 200 @@ -270,13 +272,15 @@ const ProfilePage = () => { try { debugLog(`[导入刷新] 第${retryCount + 1}次尝试刷新配置数据`) - await mutateProfiles() + const fresh = await fetchProfilesIntoCache() await new Promise((resolve) => setTimeout(resolve, baseDelay * (retryCount + 1)), ) - await onEnhance(false) + if (fresh?.current !== prevCurrent) { + await onEnhance(false) + } return } catch (error) { console.error(`[导入刷新] 第${retryCount + 1}次刷新失败:`, error) @@ -289,8 +293,10 @@ const ProfilePage = () => { console.warn(`[导入刷新] 常规刷新失败,尝试清除缓存重新获取`) try { - await fetchProfilesIntoCache() - await onEnhance(false) + const fresh = await fetchProfilesIntoCache() + if (fresh?.current !== prevCurrent) { + await onEnhance(false) + } showNotice.error( 'profiles.page.feedback.notifications.importNeedsRefresh', 3000,