From 381cc67c0d8c83e0ba4aaa50c81e897a22debb10 Mon Sep 17 00:00:00 2001 From: Matthias Date: Thu, 14 Sep 2023 20:27:41 +0200 Subject: [PATCH 01/63] Fix bug where opening chart directly fails --- .../charts/CandleChartContainer.vue | 4 +-- src/components/charts/PlotConfigurator.vue | 29 ++++++++++--------- 2 files changed, 18 insertions(+), 15 deletions(-) diff --git a/src/components/charts/CandleChartContainer.vue b/src/components/charts/CandleChartContainer.vue index ffcb8103..950873f4 100644 --- a/src/components/charts/CandleChartContainer.vue +++ b/src/components/charts/CandleChartContainer.vue @@ -72,7 +72,7 @@
- +
- + diff --git a/src/components/charts/PlotConfigurator.vue b/src/components/charts/PlotConfigurator.vue index ce46e4ec..f4ceef0e 100644 --- a/src/components/charts/PlotConfigurator.vue +++ b/src/components/charts/PlotConfigurator.vue @@ -166,12 +166,12 @@ import PlotIndicatorSelect from './PlotIndicatorSelect.vue'; import { deepClone } from '@/shared/deepClone'; import { useBotStore } from '@/stores/ftbotwrapper'; import { usePlotConfigStore } from '@/stores/plotConfig'; -import { computed, onMounted, onUnmounted, ref, watch } from 'vue'; +import { computed, ref, watch } from 'vue'; import randomColor from '@/shared/randomColor'; -defineProps({ +const props = defineProps({ columns: { required: true, type: Array as () => string[] }, - asModal: { required: false, default: true, type: Boolean }, + isVisible: { required: true, default: false, type: Boolean }, }); const plotStore = usePlotConfigStore(); @@ -360,16 +360,19 @@ watch( }, ); -onMounted(() => { - // Deep clone and assign to editable - plotStore.editablePlotConfig = deepClone(plotStore.plotConfig); - plotStore.isEditing = true; - plotConfigNameLoc.value = plotStore.plotConfigName; -}); -onUnmounted(() => { - // TODO: Unmounted is not called when closing in Chart view - plotStore.isEditing = false; -}); +watch( + () => props.isVisible, + () => { + if (props.isVisible) { + // Deep clone and assign to editable + plotStore.editablePlotConfig = deepClone(plotStore.plotConfig); + plotStore.isEditing = true; + plotConfigNameLoc.value = plotStore.plotConfigName; + } else { + plotStore.isEditing = false; + } + }, +);