From a03f1bb917e49fe0f83946e33fd48c765db081ff Mon Sep 17 00:00:00 2001 From: Matthias Date: Tue, 7 Mar 2023 18:19:44 +0100 Subject: [PATCH] Improve handling of empty pair-data responses --- src/components/charts/CandleChartContainer.vue | 2 +- src/stores/ftbot.ts | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/components/charts/CandleChartContainer.vue b/src/components/charts/CandleChartContainer.vue index 1dc28c87..7e35d6e8 100644 --- a/src/components/charts/CandleChartContainer.vue +++ b/src/components/charts/CandleChartContainer.vue @@ -132,7 +132,7 @@ const dataset = computed((): PairHistory => { }); const strategyName = computed(() => props.strategy || dataset.value?.strategy || ''); const datasetColumns = computed(() => (dataset.value ? dataset.value.columns : [])); -const hasDataset = computed(() => !!dataset.value); +const hasDataset = computed(() => dataset.value && dataset.value.data.length > 0); const isLoadingDataset = computed((): boolean => { if (props.historicView) { return botStore.activeBot.historyStatus === LoadingStatus.loading; diff --git a/src/stores/ftbot.ts b/src/stores/ftbot.ts index 233e90f9..8cc6cc67 100644 --- a/src/stores/ftbot.ts +++ b/src/stores/ftbot.ts @@ -340,7 +340,7 @@ export function createBotSubStore(botId: string, botName: string) { }, getPairCandles(payload: PairCandlePayload) { if (payload.pair && payload.timeframe) { - this.historyStatus = LoadingStatus.loading; + this.candleDataStatus = LoadingStatus.loading; return api .get('/pair_candles', { params: { ...payload }, @@ -354,11 +354,11 @@ export function createBotSubStore(botId: string, botName: string) { data: result.data, }, }; - this.historyStatus = LoadingStatus.success; + this.candleDataStatus = LoadingStatus.success; }) .catch((err) => { console.error(err); - this.historyStatus = LoadingStatus.error; + this.candleDataStatus = LoadingStatus.error; }); } // Error branchs