diff --git a/src/components/ftbot/ReloadControl.vue b/src/components/ftbot/ReloadControl.vue index 0ca73901..64197796 100644 --- a/src/components/ftbot/ReloadControl.vue +++ b/src/components/ftbot/ReloadControl.vue @@ -33,7 +33,7 @@ export default class ReloadControl extends Vue { } mounted() { - this.startRefresh(); + this.startRefresh(false); } beforeDestroy() { @@ -63,19 +63,23 @@ export default class ReloadControl extends Vue { this.setAutoRefresh(newValue); } - startRefresh() { + startRefresh(runNow: boolean) { if (this.loggedIn !== true) { console.log('Not logged in.'); return; } console.log('Starting automatic refresh.'); - this.refreshFrequent(); + if (runNow) { + this.refreshFrequent(false); + } if (this.autoRefresh) { this.refreshInterval = window.setInterval(() => { this.refreshFrequent(); }, 5000); } - this.refreshSlow(true); + if (runNow) { + this.refreshSlow(true); + } if (this.autoRefresh) { this.refreshIntervalSlow = window.setInterval(() => { this.refreshSlow(false); @@ -96,7 +100,7 @@ export default class ReloadControl extends Vue { @Watch('autoRefresh') watchAutoRefresh(val) { if (val) { - this.startRefresh(); + this.startRefresh(true); } else { this.stopRefresh(); } diff --git a/src/store/index.ts b/src/store/index.ts index 34842094..cc7736c2 100644 --- a/src/store/index.ts +++ b/src/store/index.ts @@ -117,8 +117,10 @@ export default new Vuex.Store({ commit('ftbot/updateRefreshRequired', false); } }, - refreshFrequent({ dispatch }) { - dispatch('refreshSlow', false); + refreshFrequent({ dispatch }, slow = true) { + if (slow) { + dispatch('refreshSlow', false); + } // Refresh data that's needed in near realtime dispatch('ftbot/getOpenTrades'); dispatch('ftbot/getState');