From e930d0c3f38e3bf41acab2f293f7169e42394a72 Mon Sep 17 00:00:00 2001 From: Miodec Date: Fri, 31 Oct 2025 18:15:45 +0100 Subject: [PATCH] fix: unable to delete a preset in some cases closes #7068 closes #7064 --- frontend/src/ts/modals/edit-preset.ts | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/frontend/src/ts/modals/edit-preset.ts b/frontend/src/ts/modals/edit-preset.ts index cf0e6a258..5b235f12d 100644 --- a/frontend/src/ts/modals/edit-preset.ts +++ b/frontend/src/ts/modals/edit-preset.ts @@ -254,17 +254,21 @@ async function apply(): Promise { return; } - const noPresetName: boolean = - ["add", "edit"].includes(action) && - presetName.replace(/^_+|_+$/g, "").length === 0; //all whitespace names are rejected - if (noPresetName) { - Notifications.add("Preset name cannot be empty", 0); - return; - } + const addOrEditAction = action === "add" || action === "edit"; + if (addOrEditAction) { + //validate the preset name only in add or edit mode - if (presetNameEl?.getValidationResult().status === "failed") { - Notifications.add("Preset name is not valid", 0); - return; + const noPresetName: boolean = + presetName.replace(/^_+|_+$/g, "").length === 0; //all whitespace names are rejected + if (noPresetName) { + Notifications.add("Preset name cannot be empty", 0); + return; + } + + if (presetNameEl?.getValidationResult().status === "failed") { + Notifications.add("Preset name is not valid", 0); + return; + } } hide();