mirror of
https://github.com/fawney19/Aether.git
synced 2026-09-02 01:10:23 +08:00
fix: 单个提供商更新时不再清空全部余额缓存
loadBalances 新增 fullReload 参数,单个提供商刷新时传入 false, 避免更新一个提供商的余额数据时清除其他提供商的已加载余额。
This commit is contained in:
@@ -57,9 +57,10 @@ export function useProviderBalance() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 异步加载余额数据(使用批量接口)
|
// 异步加载余额数据(使用批量接口)
|
||||||
async function loadBalances(providers: ProviderWithEndpointsSummary[]) {
|
async function loadBalances(providers: ProviderWithEndpointsSummary[], fullReload = true) {
|
||||||
// 清空旧的余额缓存,避免数据累积
|
if (fullReload) {
|
||||||
balanceCache.value = {}
|
balanceCache.value = {}
|
||||||
|
}
|
||||||
const currentVersion = ++balanceLoadVersion
|
const currentVersion = ++balanceLoadVersion
|
||||||
try {
|
try {
|
||||||
const opsProviderIds = providers.filter(p => p.ops_configured).map(p => p.id)
|
const opsProviderIds = providers.filter(p => p.ops_configured).map(p => p.id)
|
||||||
|
|||||||
@@ -437,7 +437,7 @@ function handleProviderUpdated(updated: ProviderWithEndpointsSummary) {
|
|||||||
if (index !== -1) {
|
if (index !== -1) {
|
||||||
providers.value[index] = updated
|
providers.value[index] = updated
|
||||||
// 刷新该提供商的余额数据
|
// 刷新该提供商的余额数据
|
||||||
loadBalances([updated])
|
loadBalances([updated], false)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -449,7 +449,7 @@ async function handleDrawerRefresh() {
|
|||||||
const index = providers.value.findIndex(p => p.id === updated.id)
|
const index = providers.value.findIndex(p => p.id === updated.id)
|
||||||
if (index !== -1) {
|
if (index !== -1) {
|
||||||
providers.value[index] = updated
|
providers.value[index] = updated
|
||||||
loadBalances([updated])
|
loadBalances([updated], false)
|
||||||
}
|
}
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
showError(parseApiError(err, '刷新提供商数据失败'), '错误')
|
showError(parseApiError(err, '刷新提供商数据失败'), '错误')
|
||||||
|
|||||||
Reference in New Issue
Block a user