fix(reaction): dedupe sort request when not on page 1
handleSorter previously mutated query.page then called listStats() synchronously, while a separate page/limit watcher also fired on the page reset, producing two identical requests whenever sorting was triggered from page 2+. ordering is now part of the watched sources so page+ordering mutations from handleSorter batch into a single watcher run. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
@@ -80,7 +80,6 @@ function handleSorter(sorter: { columnKey: string; order: string | false }) {
|
||||
(sorter.order === "descend" ? "-" : "") + String(sorter.columnKey)
|
||||
}
|
||||
query.page = 1
|
||||
listStats()
|
||||
}
|
||||
|
||||
async function listStats() {
|
||||
@@ -96,7 +95,7 @@ async function listStats() {
|
||||
}
|
||||
|
||||
onMounted(listStats)
|
||||
watch(() => [query.page, query.limit], listStats)
|
||||
watch(() => [query.page, query.limit, query.ordering], listStats)
|
||||
watchDebounced(() => query.problem, listStats, {
|
||||
debounce: 500,
|
||||
maxWait: 1000,
|
||||
|
||||
Reference in New Issue
Block a user