diff --git a/src/stores/transaction.ts b/src/stores/transaction.ts index e7f0a692..d67f2bdf 100644 --- a/src/stores/transaction.ts +++ b/src/stores/transaction.ts @@ -1274,9 +1274,9 @@ export const useTransactionsStore = defineStore('transactions', () => { return services.getTransactionPictureUrlWithToken(pictureInfo.originalUrl, disableBrowserCache); } - function collapseMonthInTransactionList({ month, collapse }: { month: TransactionMonthList, collapse: boolean }): void { - if (month) { - month.opened = !collapse; + function collapseMonthInTransactionList({ monthList, collapse }: { monthList: TransactionMonthList, collapse: boolean }): void { + if (monthList) { + monthList.opened = !collapse; } } diff --git a/src/views/mobile/transactions/ListPage.vue b/src/views/mobile/transactions/ListPage.vue index 193f058e..72d3c9a3 100644 --- a/src/views/mobile/transactions/ListPage.vue +++ b/src/views/mobile/transactions/ListPage.vue @@ -177,7 +177,9 @@ :key="transactionMonthList.yearMonth" v-for="(transactionMonthList) in transactions"> + @accordion:opened="onTransactionMonthListCollapseStateChanged" + @accordion:close="collapseTransactionMonthList(transactionMonthList, true)" + @accordion:closed="onTransactionMonthListCollapseStateChanged"> - + + - { - return setTransactionMonthListHeights(false); - }).then(() => { - setTransactionInvisibleYearMonthList(); - }); + if (!collapse && transactionInvisibleYearMonths.value[monthList.yearMonth]) { + delete transactionInvisibleYearMonths.value[monthList.yearMonth]; + } } function onPopoverOpen(event: { $el: Framework7Dom }): void { @@ -1443,6 +1441,13 @@ function onScroll(): void { setTransactionInvisibleYearMonthList(); } +function onTransactionMonthListCollapseStateChanged(): void { + setTransactionMonthListHeights(false) + .then(() => { + setTransactionInvisibleYearMonthList(); + }); +} + onMounted(() => { window.addEventListener('resize', onResize); onInfiniteScrolling(onScroll);