From 5d99ca9350573b07eca710a9e6f461e258abb818 Mon Sep 17 00:00:00 2001 From: AmbrishRamachandiran Date: Wed, 26 Jul 2023 09:48:50 +0530 Subject: [PATCH] Limit the use of the same shortcut name when adding a shortcut Signed-off-by: AmbrishRamachandiran --- plugins/shortcuts/src/EditShortcut.tsx | 19 ++++++------------- 1 file changed, 6 insertions(+), 13 deletions(-) diff --git a/plugins/shortcuts/src/EditShortcut.tsx b/plugins/shortcuts/src/EditShortcut.tsx index ecc14d93d9..9f2ffe10be 100644 --- a/plugins/shortcuts/src/EditShortcut.tsx +++ b/plugins/shortcuts/src/EditShortcut.tsx @@ -70,19 +70,12 @@ export const EditShortcut = ({ }; try { - if (api.get().some(shortcutTitle => shortcutTitle.title === title)) { - alertApi.post({ - message: `Shortcut title already exist`, - severity: 'error', - }); - } else { - await api.update(newShortcut); - alertApi.post({ - message: `Updated shortcut '${title}'`, - severity: 'success', - display: 'transient', - }); - } + await api.update(newShortcut); + alertApi.post({ + message: `Updated shortcut '${title}'`, + severity: 'success', + display: 'transient', + }); } catch (error) { alertApi.post({ message: `Could not update shortcut: ${error.message}`,