fix(client): retain requested page during loading and failed queries

This commit is contained in:
2026-10-03 19:16:09 +08:00
parent 40f6753cca
commit a0736239e4
2 changed files with 70 additions and 1 deletions
+3 -1
View File
@@ -88,7 +88,9 @@ watch([pageSize, normalizedPageSizes], ([value, sizes]) => {
page.value = 1
}, { immediate: true })
watch([page, pageCount], ([value, count]) => {
watch([page, pageCount, () => props.loading, () => Boolean(slots.error)], ([value, count, loading, hasError]) => {
// A cleared total is not an authoritative page count while loading or showing a request error.
if (loading || hasError) return
const nextValue = normalizePage(value, count)
if (value !== nextValue) page.value = nextValue
}, { immediate: true })