mirror of
https://github.com/fawney19/Aether.git
synced 2026-09-02 09:20:22 +08:00
perf: Pool 账号删除后改用乐观更新替代全量重载
- PoolAccountBatchDialog: 批量删除全部成功时直接从本地列表移除,其余操作保留原重载逻辑 - PoolManagement: 单个删除后本地移除条目并更新 total,当前页为空时自动跳转前一页
This commit is contained in:
@@ -1885,7 +1885,13 @@ async function handleDeleteKey(key: PoolKeyDetail) {
|
||||
try {
|
||||
await deleteEndpointKey(key.key_id)
|
||||
success('账号已删除')
|
||||
await loadKeys()
|
||||
// 乐观更新:直接从本地列表移除,避免等待网络重载
|
||||
keyPage.value.keys = keyPage.value.keys.filter(k => k.key_id !== key.key_id)
|
||||
keyPage.value.total = Math.max(0, keyPage.value.total - 1)
|
||||
// 当前页已空且不是第一页时,自动跳转到前一页
|
||||
if (keyPage.value.keys.length === 0 && currentPage.value > 1) {
|
||||
currentPage.value--
|
||||
}
|
||||
} catch (err) {
|
||||
showError(parseApiError(err, '删除账号失败'))
|
||||
} finally {
|
||||
|
||||
Reference in New Issue
Block a user