feat(frontend): implement P0 optimization baseline
This commit is contained in:
@@ -30,6 +30,7 @@ const pagination = ref<AdminPagination>({
|
||||
})
|
||||
|
||||
const canReplay = hasAdminRole('admin')
|
||||
let latestRequestId = 0
|
||||
|
||||
const summary = computed(() => ({
|
||||
processedCount: items.value.filter((item) => item.processed).length,
|
||||
@@ -38,6 +39,7 @@ const summary = computed(() => ({
|
||||
}))
|
||||
|
||||
async function loadEvents(page = pagination.value.page) {
|
||||
const requestId = ++latestRequestId
|
||||
loading.value = true
|
||||
errorMessage.value = ''
|
||||
|
||||
@@ -54,12 +56,23 @@ async function loadEvents(page = pagination.value.page) {
|
||||
dateFrom: dateFrom.value.trim(),
|
||||
dateTo: dateTo.value.trim(),
|
||||
})
|
||||
|
||||
if (requestId !== latestRequestId) {
|
||||
return
|
||||
}
|
||||
|
||||
items.value = response.data.items
|
||||
pagination.value = response.data.pagination
|
||||
} catch (error) {
|
||||
if (requestId !== latestRequestId) {
|
||||
return
|
||||
}
|
||||
|
||||
errorMessage.value = error instanceof Error ? error.message : '读取 webhook 列表失败'
|
||||
} finally {
|
||||
loading.value = false
|
||||
if (requestId === latestRequestId) {
|
||||
loading.value = false
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user