From e32dc05999001545e68f1a3709974cccee9aed38 Mon Sep 17 00:00:00 2001 From: ryan Date: Sat, 21 Jun 2025 03:02:15 +0300 Subject: [PATCH] feat(ItemsList): improve property addition validation --- src/components/ItemsList.tsx | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/components/ItemsList.tsx b/src/components/ItemsList.tsx index 3ef91c1..64de2e2 100644 --- a/src/components/ItemsList.tsx +++ b/src/components/ItemsList.tsx @@ -386,8 +386,15 @@ export function ItemsList({ url }: ItemsListProps) { console.log('Adding property:', property); const normalizedProperty = property.replace('http://www.wikidata.org/prop/', ''); - if (!normalizedProperty || selectedProperties[normalizedProperty]) { - console.log('Property already exists or invalid:', normalizedProperty); + // Check if property is invalid, + if (!normalizedProperty) { + console.log('Property is invalid:', normalizedProperty); + return; + } + + // Check if property is already in customProperties array (visible in UI) + if (customProperties.includes(normalizedProperty)) { + console.log('Property already visible in UI:', normalizedProperty); return; }