From 8cc40272c78ec000af3a5997a312855dabd6dac1 Mon Sep 17 00:00:00 2001 From: Catherine Renelle <32781029+catrenelle@users.noreply.github.com> Date: Mon, 9 Feb 2026 21:12:41 -0500 Subject: [PATCH] Fix server-side pagination returning same data on every page v-data-table-server re-emits update:options when items/totalCount change, creating a loop that resets to page 1. Guard against redundant fetches by skipping when page and pageSize haven't changed. Remove duplicate loadTransactions from onMounted since the table's initial update:options event handles the first load. Co-Authored-By: Claude Opus 4.6 --- frontend/src/views/transactions/TransactionsView.vue | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/frontend/src/views/transactions/TransactionsView.vue b/frontend/src/views/transactions/TransactionsView.vue index ac34677..641c728 100644 --- a/frontend/src/views/transactions/TransactionsView.vue +++ b/frontend/src/views/transactions/TransactionsView.vue @@ -263,10 +263,12 @@ onMounted(async () => { const acct = accountsStore.accounts.find(a => a.id === props.id) accountName.value = acct?.name || '' } - await loadTransactions() }) -watch(() => props.id, () => loadTransactions()) +watch(() => props.id, () => { + page.value = 1 + loadTransactions() +}) async function loadCategories() { try { @@ -305,7 +307,10 @@ function doSearch() { loadTransactions() } +let initialized = false function onTableOptions(options: { page: number; itemsPerPage: number }) { + if (initialized && options.page === page.value && options.itemsPerPage === itemsPerPage.value) return + initialized = true page.value = options.page itemsPerPage.value = options.itemsPerPage loadTransactions()