feat(ItemsList): improve property addition validation

This commit is contained in:
ryan 2025-06-21 03:02:15 +03:00
parent 16b892b0e2
commit e32dc05999

View file

@ -386,8 +386,15 @@ export function ItemsList({ url }: ItemsListProps) {
console.log('Adding property:', property); console.log('Adding property:', property);
const normalizedProperty = property.replace('http://www.wikidata.org/prop/', ''); const normalizedProperty = property.replace('http://www.wikidata.org/prop/', '');
if (!normalizedProperty || selectedProperties[normalizedProperty]) { // Check if property is invalid,
console.log('Property already exists or invalid:', normalizedProperty); 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; return;
} }