From 4fc72b7d419eb035300905c3bab12d9f510135c8 Mon Sep 17 00:00:00 2001 From: Mariusz Bartnik Date: Thu, 5 Feb 2026 07:10:52 +0100 Subject: [PATCH] fix: prevent error when lastTag is undefined Added a check to ensure lastTag exists before proceeding with tag validation. --- admin/src/components/Input.jsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/admin/src/components/Input.jsx b/admin/src/components/Input.jsx index 510cbd2..5fe835b 100644 --- a/admin/src/components/Input.jsx +++ b/admin/src/components/Input.jsx @@ -62,10 +62,10 @@ const Tags = ({ const lastTag = newTags[newTags.length - 1]; const suggestionsArray = suggestions.data || []; const existingTag = suggestionsArray.find( - (s) => s[attrName]?.toLowerCase() === lastTag.toLowerCase() + (s) => s[attrName]?.toLowerCase() === lastTag?.toLowerCase() ); - if (!existingTag) { + if (lastTag && !existingTag) { if (apiUrl) { try { const response = await axios.post(apiUrl, {