From 1ba29e80fab51b843b28a015c2150ce1ab171734 Mon Sep 17 00:00:00 2001 From: Matthias Date: Sun, 26 Sep 2021 09:21:53 +0200 Subject: [PATCH] Improve global refresh behavior --- src/components/ftbot/ReloadControl.vue | 2 +- src/store/modules/botStoreWrapper.ts | 10 +++++----- src/store/modules/ftbot/index.ts | 5 +---- 3 files changed, 7 insertions(+), 10 deletions(-) diff --git a/src/components/ftbot/ReloadControl.vue b/src/components/ftbot/ReloadControl.vue index 6b194ecb..417d8d8e 100644 --- a/src/components/ftbot/ReloadControl.vue +++ b/src/components/ftbot/ReloadControl.vue @@ -10,7 +10,7 @@ variant="secondary" size="sm" title="Auto Refresh All bots" - @click="allRefreshFull(true)" + @click="allRefreshFull" > diff --git a/src/store/modules/botStoreWrapper.ts b/src/store/modules/botStoreWrapper.ts index 5ed72bf0..7d77ae3a 100644 --- a/src/store/modules/botStoreWrapper.ts +++ b/src/store/modules/botStoreWrapper.ts @@ -235,14 +235,14 @@ export default function createBotStore(store) { setGlobalAutoRefresh({ commit }, value: boolean) { commit('setGlobalAutoRefresh', value); }, - allRefreshFrequent({ dispatch, getters }, slow: boolean) { + allRefreshFrequent({ dispatch, getters }, forceUpdate = false) { getters.allAvailableBotsList.forEach((e) => { if ( getters[`${e}/${BotStoreGetters.refreshNow}`] && - getters[MultiBotStoreGetters.globalAutoRefresh] + (getters[MultiBotStoreGetters.globalAutoRefresh] || forceUpdate) ) { // console.log('refreshing', e); - dispatch(`${e}/${BotStoreActions.refreshFrequent}`, slow); + dispatch(`${e}/${BotStoreActions.refreshFrequent}`); } }); }, @@ -250,13 +250,13 @@ export default function createBotStore(store) { getters.allAvailableBotsList.forEach((e) => { if ( getters[`${e}/${BotStoreGetters.refreshNow}`] && - getters[MultiBotStoreGetters.globalAutoRefresh] + (getters[MultiBotStoreGetters.globalAutoRefresh] || forceUpdate) ) { dispatch(`${e}/${BotStoreActions.refreshSlow}`, forceUpdate); } }); }, - async allRefreshFull({ commit, dispatch, state }, forceUpdate = false) { + async allRefreshFull({ commit, dispatch, state }) { if (state.refreshing) { return; } diff --git a/src/store/modules/ftbot/index.ts b/src/store/modules/ftbot/index.ts index 7c1a88f8..3e1b7b79 100644 --- a/src/store/modules/ftbot/index.ts +++ b/src/store/modules/ftbot/index.ts @@ -479,10 +479,7 @@ export function createBotSubStore(botId: string, botName: string) { dispatch('setRefreshRequired', false); } }, - [BotStoreActions.refreshFrequent]({ dispatch }, slow = true) { - if (slow) { - dispatch('refreshSlow', false); - } + [BotStoreActions.refreshFrequent]({ dispatch }) { // Refresh data that's needed in near realtime dispatch('getOpenTrades'); dispatch('getState');