From a91f0f7ee562e3bf412be874a4aa73f31aeda950 Mon Sep 17 00:00:00 2001 From: Cohee <18619528+Cohee1207@users.noreply.github.com> Date: Sun, 17 Dec 2023 21:02:32 +0200 Subject: [PATCH] Fix saving presets after deletion of the same name --- public/scripts/preset-manager.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/public/scripts/preset-manager.js b/public/scripts/preset-manager.js index 8b88f97a1..3a7a48907 100644 --- a/public/scripts/preset-manager.js +++ b/public/scripts/preset-manager.js @@ -323,7 +323,7 @@ class PresetManager { } async deleteCurrentPreset() { - const { preset_names } = this.getPresetList(); + const { preset_names, presets } = this.getPresetList(); const value = this.getSelectedPreset(); const nameToDelete = this.getSelectedPresetName(); @@ -335,7 +335,9 @@ class PresetManager { $(this.select).find(`option[value="${value}"]`).remove(); if (this.isKeyedApi()) { - preset_names.splice(preset_names.indexOf(value), 1); + const index = preset_names.indexOf(nameToDelete); + preset_names.splice(index, 1); + presets.splice(index, 1); } else { delete preset_names[nameToDelete]; }