From 47ceb07d1b55296f4f2f2fc7a2a92e296d1867e7 Mon Sep 17 00:00:00 2001 From: Simon Vieille Date: Mon, 10 Feb 2025 17:52:30 +0100 Subject: [PATCH] feat(CategoriesStats): add more stats --- .../components/dashboard/CategoriesStats.vue | 29 +++++++++++++++++-- 1 file changed, 26 insertions(+), 3 deletions(-) diff --git a/frontend/js/components/dashboard/CategoriesStats.vue b/frontend/js/components/dashboard/CategoriesStats.vue index c6a603b..de5fcc0 100644 --- a/frontend/js/components/dashboard/CategoriesStats.vue +++ b/frontend/js/components/dashboard/CategoriesStats.vue @@ -19,28 +19,31 @@ Total Débit moyen / transaction Débit moyen / mois Transactions { + const key = `${dateFrom}-${dateTo}-${order}` + + if (cache !== null && cacheKey === key) { + return cache + } + + cacheKey = key + cache = compute(data, dateFrom, dateTo, order) + + return cache +} + watch(order, (v) => saveStorage('dashboard:debitAverage:order', v)) defineProps(['data', 'dateFrom', 'dateTo'])