From 85557c28791257d23e17d20539e8169f25972b93 Mon Sep 17 00:00:00 2001 From: MaysWind Date: Wed, 22 Jan 2025 23:12:58 +0800 Subject: [PATCH] fix "Save Display Order" still displays bug when adjusting the order and then restoring the original order in the desktop version --- src/stores/account.ts | 2 +- src/stores/exchangeRates.ts | 2 +- src/stores/overview.ts | 2 +- src/stores/statistics.js | 4 ++-- src/stores/transactionCategory.ts | 2 +- src/stores/transactionTag.ts | 2 +- src/stores/transactionTemplate.js | 2 +- src/views/desktop/accounts/ListPage.vue | 2 +- src/views/desktop/categories/ListPage.vue | 4 ++++ src/views/desktop/tags/ListPage.vue | 4 ++++ src/views/desktop/templates/ListPage.vue | 4 ++++ 11 files changed, 21 insertions(+), 9 deletions(-) diff --git a/src/stores/account.ts b/src/stores/account.ts index c66bd67e..0fb803a4 100644 --- a/src/stores/account.ts +++ b/src/stores/account.ts @@ -726,7 +726,7 @@ export const useAccountsStore = defineStore('accounts', () => { const accounts = Account.ofMany(data.result); if (force && data.result && isEquals(allAccounts.value, accounts)) { - reject({ message: 'Account list is up to date' }); + reject({ message: 'Account list is up to date', isUpToDate: true }); return; } diff --git a/src/stores/exchangeRates.ts b/src/stores/exchangeRates.ts index 1a13b0f7..c7b7f801 100644 --- a/src/stores/exchangeRates.ts +++ b/src/stores/exchangeRates.ts @@ -89,7 +89,7 @@ export const useExchangeRatesStore = defineStore('exchangeRates', () => { const currentData = getExchangeRatesFromLocalStorage(); if (force && currentData && currentData.data && isEquals(currentData.data, data.result)) { - reject({ message: 'Exchange rates data is up to date' }); + reject({ message: 'Exchange rates data is up to date', isUpToDate: true }); return; } diff --git a/src/stores/overview.ts b/src/stores/overview.ts index 14bd5905..a41c786a 100644 --- a/src/stores/overview.ts +++ b/src/stores/overview.ts @@ -332,7 +332,7 @@ export const useOverviewStore = defineStore('overview', () => { } if (force && data.result && isEquals(transactionOverviewData.value, data.result)) { - reject({ message: 'Data is up to date' }); + reject({ message: 'Data is up to date', isUpToDate: true }); return; } diff --git a/src/stores/statistics.js b/src/stores/statistics.js index d175ba4b..e2c7ba88 100644 --- a/src/stores/statistics.js +++ b/src/stores/statistics.js @@ -938,7 +938,7 @@ export const useStatisticsStore = defineStore('statistics', { } if (force && data.result && isEquals(self.transactionCategoryStatisticsData, data.result)) { - reject({ message: 'Data is up to date' }); + reject({ message: 'Data is up to date', isUpToDate: true }); return; } @@ -982,7 +982,7 @@ export const useStatisticsStore = defineStore('statistics', { } if (force && data.result && isEquals(self.transactionCategoryTrendsData, data.result)) { - reject({ message: 'Data is up to date' }); + reject({ message: 'Data is up to date', isUpToDate: true }); return; } diff --git a/src/stores/transactionCategory.ts b/src/stores/transactionCategory.ts index 9b6cad59..21984b44 100644 --- a/src/stores/transactionCategory.ts +++ b/src/stores/transactionCategory.ts @@ -195,7 +195,7 @@ export const useTransactionCategoriesStore = defineStore('transactionCategories' const transactionCategories = TransactionCategory.ofMap(data.result); if (force && data.result && isEquals(allTransactionCategories.value, transactionCategories)) { - reject({ message: 'Category list is up to date' }); + reject({ message: 'Category list is up to date', isUpToDate: true }); return; } diff --git a/src/stores/transactionTag.ts b/src/stores/transactionTag.ts index b5af6146..e5db9070 100644 --- a/src/stores/transactionTag.ts +++ b/src/stores/transactionTag.ts @@ -115,7 +115,7 @@ export const useTransactionTagsStore = defineStore('transactionTags', () => { const transactionTags = TransactionTag.ofMany(data.result); if (force && data.result && isEquals(allTransactionTags.value, transactionTags)) { - reject({ message: 'Tag list is up to date' }); + reject({ message: 'Tag list is up to date', isUpToDate: true }); return; } diff --git a/src/stores/transactionTemplate.js b/src/stores/transactionTemplate.js index 94b429fc..6ac217e8 100644 --- a/src/stores/transactionTemplate.js +++ b/src/stores/transactionTemplate.js @@ -161,7 +161,7 @@ export const useTransactionTemplatesStore = defineStore('transactionTemplates', } if (force && data.result && isEquals(self.allTransactionTemplates[templateType], data.result)) { - reject({ message: 'Template list is up to date' }); + reject({ message: 'Template list is up to date', isUpToDate: true }); return; } diff --git a/src/views/desktop/accounts/ListPage.vue b/src/views/desktop/accounts/ListPage.vue index bd11e4e8..016247e7 100644 --- a/src/views/desktop/accounts/ListPage.vue +++ b/src/views/desktop/accounts/ListPage.vue @@ -433,7 +433,7 @@ export default { }).catch(error => { self.loading = false; - if (error && error.message === 'Account list is up to date') { + if (error && error.isUpToDate) { self.displayOrderModified = false; } diff --git a/src/views/desktop/categories/ListPage.vue b/src/views/desktop/categories/ListPage.vue index bec1f3e6..a161caec 100644 --- a/src/views/desktop/categories/ListPage.vue +++ b/src/views/desktop/categories/ListPage.vue @@ -348,6 +348,10 @@ function reload(force: boolean): void { }).catch(error => { loading.value = false; + if (error && error.isUpToDate) { + displayOrderModified.value = false; + } + if (!error.processed) { snackbar.value?.showError(error); } diff --git a/src/views/desktop/tags/ListPage.vue b/src/views/desktop/tags/ListPage.vue index dde5b21f..8b9c9f40 100644 --- a/src/views/desktop/tags/ListPage.vue +++ b/src/views/desktop/tags/ListPage.vue @@ -317,6 +317,10 @@ function reload(): void { }).catch(error => { loading.value = false; + if (error && error.isUpToDate) { + displayOrderModified.value = false; + } + if (!error.processed) { snackbar.value?.showError(error); } diff --git a/src/views/desktop/templates/ListPage.vue b/src/views/desktop/templates/ListPage.vue index cea530a8..eeade772 100644 --- a/src/views/desktop/templates/ListPage.vue +++ b/src/views/desktop/templates/ListPage.vue @@ -254,6 +254,10 @@ export default { }).catch(error => { self.loading = false; + if (error && error.isUpToDate) { + self.displayOrderModified = false; + } + if (!error.processed) { self.$refs.snackbar.showError(error); }