From efcfac5774d3af3fa92b671421a181a90df3e584 Mon Sep 17 00:00:00 2001 From: gozzy Date: Wed, 23 Nov 2022 04:45:56 +0000 Subject: [PATCH] stop unnecessary statistic reqs --- pages/index.vue | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/pages/index.vue b/pages/index.vue index ecf147d..ab8583b 100644 --- a/pages/index.vue +++ b/pages/index.vue @@ -158,8 +158,19 @@ export default { } } } else { - const { currency, amount } = this.selectedInstance - this.$store.dispatch('application/setAndUpdateStatistic', { currency, amount }) + const userSelection = this.selectedInstance + const stateSelection = this.selectedStatistic + + if ( + !stateSelection || + userSelection.amount !== stateSelection.amount || + userSelection.currency !== stateSelection.currency + ) { + this.$store.dispatch('application/setAndUpdateStatistic', { + currency: userSelection.currency, + amount: userSelection.amount + }) + } } } }