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]; }