Skip to content

Commit aefb058

Browse files
committed
fix: reset current page to 1 on sort change to ensure correct data display
1 parent 92c3685 commit aefb058

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

adminforth/spa/src/afcl/Table.vue

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,12 @@
211211
});
212212
213213
watch([() => currentSortField.value, () => currentSortDirection.value], () => {
214-
refresh();
214+
const needsPageReset = currentPage.value !== 1;
215+
if (needsPageReset) {
216+
currentPage.value = 1;
217+
} else {
218+
refresh();
219+
}
215220
emit('update:sortField', currentSortField.value);
216221
emit('update:sortDirection', currentSortField.value ? currentSortDirection.value : undefined);
217222
const field = currentSortField.value ?? null;

0 commit comments

Comments
 (0)