do not reload transaction list when filter is not changed actually

This commit is contained in:
MaysWind
2024-07-07 11:07:26 +08:00
parent 9eddab3dd8
commit 297f8b9987
8 changed files with 175 additions and 95 deletions
@@ -241,6 +241,7 @@ export default {
const router = self.f7router;
const filteredAccountIds = {};
let isAllSelected = true;
let finalAccountIds = '';
for (let accountId in self.filterAccountIds) {
@@ -252,6 +253,7 @@ export default {
if (!isAccountOrSubAccountsAllChecked(account, self.filterAccountIds)) {
filteredAccountIds[accountId] = true;
isAllSelected = false;
} else {
if (finalAccountIds.length > 0) {
finalAccountIds += ',';
@@ -268,10 +270,13 @@ export default {
filterAccountIds: filteredAccountIds
});
} else if (this.type === 'transactionListCurrent') {
self.transactionsStore.updateTransactionListFilter({
accountIds: finalAccountIds
const changed = self.transactionsStore.updateTransactionListFilter({
accountIds: isAllSelected ? '' : finalAccountIds
});
self.transactionsStore.updateTransactionListInvalidState(true);
if (changed) {
self.transactionsStore.updateTransactionListInvalidState(true);
}
}
router.back();
@@ -256,6 +256,7 @@ export default {
const router = self.f7router;
const filteredCategoryIds = {};
let isAllSelected = true;
let finalCategoryIds = '';
for (let categoryId in self.filterCategoryIds) {
@@ -267,6 +268,7 @@ export default {
if (!isCategoryOrSubCategoriesAllChecked(category, self.filterCategoryIds)) {
filteredCategoryIds[categoryId] = true;
isAllSelected = false;
} else {
if (finalCategoryIds.length > 0) {
finalCategoryIds += ',';
@@ -283,10 +285,13 @@ export default {
filterCategoryIds: filteredCategoryIds
});
} else if (this.type === 'transactionListCurrent') {
self.transactionsStore.updateTransactionListFilter({
categoryIds: finalCategoryIds
const changed = self.transactionsStore.updateTransactionListFilter({
categoryIds: isAllSelected ? '' : finalCategoryIds
});
self.transactionsStore.updateTransactionListInvalidState(true);
if (changed) {
self.transactionsStore.updateTransactionListInvalidState(true);
}
}
router.back();