From d51246d1d120b13b3fd09d7958a375ed9983ff68 Mon Sep 17 00:00:00 2001 From: Matthias Date: Sun, 28 Apr 2024 15:46:13 +0200 Subject: [PATCH] Trigger candle reload if plotconfig changes in "reduced" mode --- src/components/charts/CandleChartContainer.vue | 12 ++++++++++++ src/stores/ftbot.ts | 5 +++-- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/src/components/charts/CandleChartContainer.vue b/src/components/charts/CandleChartContainer.vue index d69c7a01..aff555ff 100644 --- a/src/components/charts/CandleChartContainer.vue +++ b/src/components/charts/CandleChartContainer.vue @@ -229,6 +229,18 @@ watch( }, ); +watch( + () => plotStore.plotConfig, + () => { + // all plotstore.usedColumns are in the dataset + const hasAllColumns = plotStore.usedColumns.every((c) => datasetColumns.value.includes(c)); + if (!props.historicView && settingsStore.useReducedPairCalls && !hasAllColumns) { + console.log('triggering refresh'); + refresh(); + } + }, +); + onMounted(() => { showPlotConfig.value = props.plotConfigModal; if (botStore.activeBot.selectedPair) { diff --git a/src/stores/ftbot.ts b/src/stores/ftbot.ts index f8f1e1fe..83a71312 100644 --- a/src/stores/ftbot.ts +++ b/src/stores/ftbot.ts @@ -352,7 +352,8 @@ export function createBotSubStore(botId: string, botName: string) { this.candleDataStatus = LoadingStatus.loading; try { let result: PairHistory | null = null; - if (this.botApiVersion >= 2.35) { + const settingsStore = useSettingsStore(); + if (this.botApiVersion >= 2.35 && settingsStore.useReducedPairCalls) { // Modern approach, allowing filtering of columns const { data } = await api.post>( '/pair_candles', @@ -381,7 +382,7 @@ export function createBotSubStore(botId: string, botName: string) { this.candleDataStatus = LoadingStatus.error; } } else { - // Error branch + // Error branchs const error = 'pair or timeframe not specified'; console.error(error); return new Promise((resolve, reject) => {