From dc859023506ad4de5687b321dd69256d963322ac Mon Sep 17 00:00:00 2001 From: Matthias Date: Sat, 6 May 2023 08:25:02 +0200 Subject: [PATCH] Improve plotconfig add / remove behavior --- src/stores/plotConfig.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/stores/plotConfig.ts b/src/stores/plotConfig.ts index 19e346b0..a0b1d396 100644 --- a/src/stores/plotConfig.ts +++ b/src/stores/plotConfig.ts @@ -48,6 +48,10 @@ export const usePlotConfigStore = defineStore('plotConfig', { }, deletePlotConfig(plotConfigName: string) { delete this.customPlotConfigs[plotConfigName]; + if (this.plotConfigName === plotConfigName) { + this.plotConfigName = + this.availablePlotConfigNames[this.availablePlotConfigNames.length - 1]; + } }, renamePlotConfig(oldName: string, newName: string) { this.customPlotConfigs[newName] = this.customPlotConfigs[oldName]; @@ -56,6 +60,7 @@ export const usePlotConfigStore = defineStore('plotConfig', { }, newPlotConfig(plotConfigName: string) { this.editablePlotConfig = deepClone(EMPTY_PLOTCONFIG); + this.saveCustomPlotConfig(plotConfigName, this.editablePlotConfig); this.plotConfigName = plotConfigName; },