From 41de90e578f2dd72767038f8b60f2acb71471b7d Mon Sep 17 00:00:00 2001 From: Matteo Pagliazzi Date: Fri, 13 Nov 2020 14:33:59 +0100 Subject: [PATCH] fix: make sure world state is not loaded every time a modal is opened, fix dev server caching on safari --- .../src/components/payments/buyGemsModal.vue | 26 ++++++++++--------- website/client/vue.config.js | 6 +++++ 2 files changed, 20 insertions(+), 12 deletions(-) diff --git a/website/client/src/components/payments/buyGemsModal.vue b/website/client/src/components/payments/buyGemsModal.vue index 8bd9e636f5..83b79bebf4 100644 --- a/website/client/src/components/payments/buyGemsModal.vue +++ b/website/client/src/components/payments/buyGemsModal.vue @@ -397,19 +397,21 @@ export default { await this.$store.dispatch('worldState:getWorldState'); this.$root.$on('bv::show::modal', (modalId, data = {}) => { - // We force reloading the world state every time the modal is reopened - // To make sure the promo status is always up to date - this.$store.dispatch('worldState:getWorldState', { forceLoad: true }); + if (modalId === 'buy-gems') { + // We force reloading the world state every time the modal is reopened + // To make sure the promo status is always up to date + this.$store.dispatch('worldState:getWorldState', { forceLoad: true }); - // Track opening of gems modal unless it's been already tracked - // For example the gems button in the menu already tracks the event by itself - if (modalId === 'buy-gems' && data.alreadyTracked !== true) { - Analytics.track({ - hitType: 'event', - eventCategory: 'button', - eventAction: 'click', - eventLabel: 'Gems > Wallet', - }); + // Track opening of gems modal unless it's been already tracked + // For example the gems button in the menu already tracks the event by itself + if (data.alreadyTracked !== true) { + Analytics.track({ + hitType: 'event', + eventCategory: 'button', + eventAction: 'click', + eventLabel: 'Gems > Wallet', + }); + } } }); }, diff --git a/website/client/vue.config.js b/website/client/vue.config.js index 6d446cb1f6..62903b8dd0 100644 --- a/website/client/vue.config.js +++ b/website/client/vue.config.js @@ -114,9 +114,15 @@ module.exports = { options.quiet = true; return options; }); + + // Fix issue with Safari cache, see https://github.com/vuejs/vue-cli/issues/2509 + if (process.env.NODE_ENV === 'development') { + config.plugins.delete('preload'); + } }, devServer: { + headers: { 'Cache-Control': 'no-store' }, disableHostCheck: true, proxy: { // proxy all requests to the server at IP:PORT as specified in the top-level config