Skip to content

Commit 92c3685

Browse files
committed
fix: reset current page to 1 on sort change and improve sort-change event emission
1 parent f11fd8c commit 92c3685

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

adminforth/spa/src/afcl/Table.vue

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -211,11 +211,12 @@
211211
});
212212
213213
watch([() => currentSortField.value, () => currentSortDirection.value], () => {
214-
if (currentPage.value !== 1) currentPage.value = 1;
215214
refresh();
216215
emit('update:sortField', currentSortField.value);
217216
emit('update:sortDirection', currentSortField.value ? currentSortDirection.value : undefined);
218-
emit('sort-change', { field: currentSortField.value, direction: currentSortDirection.value });
217+
const field = currentSortField.value ?? null;
218+
const direction = currentSortField.value ? currentSortDirection.value : null;
219+
emit('sort-change', { field, direction });
219220
}, { immediate: false });
220221
221222
const totalPages = computed(() => {

0 commit comments

Comments
 (0)