Fix saving presets after deletion of the same name
This commit is contained in:
parent
d629d96d05
commit
a91f0f7ee5
|
@ -323,7 +323,7 @@ class PresetManager {
|
||||||
}
|
}
|
||||||
|
|
||||||
async deleteCurrentPreset() {
|
async deleteCurrentPreset() {
|
||||||
const { preset_names } = this.getPresetList();
|
const { preset_names, presets } = this.getPresetList();
|
||||||
const value = this.getSelectedPreset();
|
const value = this.getSelectedPreset();
|
||||||
const nameToDelete = this.getSelectedPresetName();
|
const nameToDelete = this.getSelectedPresetName();
|
||||||
|
|
||||||
|
@ -335,7 +335,9 @@ class PresetManager {
|
||||||
$(this.select).find(`option[value="${value}"]`).remove();
|
$(this.select).find(`option[value="${value}"]`).remove();
|
||||||
|
|
||||||
if (this.isKeyedApi()) {
|
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 {
|
} else {
|
||||||
delete preset_names[nameToDelete];
|
delete preset_names[nameToDelete];
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue