From ebb1afd1af3055565d67ccca20558cc64ae9cee6 Mon Sep 17 00:00:00 2001 From: ryan Date: Tue, 25 Mar 2025 15:51:49 +0300 Subject: [PATCH] fix(properties): show property labels in custom property autocomplete dropdown --- src/components/items_list.rs | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/components/items_list.rs b/src/components/items_list.rs index 24e4fb1..9dced5e 100644 --- a/src/components/items_list.rs +++ b/src/components/items_list.rs @@ -410,10 +410,15 @@ pub fn ItemsList( let mut result = HashMap::new(); if let Some(bindings) = data["results"]["bindings"].as_array() { for binding in bindings { - let prop_label = binding["propLabel"]["value"].as_str().unwrap_or("").to_string(); - let prop_label = prop_label.replace("http://www.wikidata.org/prop/", ""); + let prop = binding["propLabel"]["value"].as_str().unwrap_or("").to_string(); + let prop_id = prop.replace("http://www.wikidata.org/prop/", ""); let value_label = binding["valueLabel"]["value"].as_str().unwrap_or("").to_string(); - result.insert(prop_label, value_label); + + // Fetch property labels + let prop_label_map = fetch_property_labels(vec![prop_id]).await; + if let Some(prop_label) = prop_label_map.values().next() { + result.insert(prop_label.clone(), value_label); + } log!("result: {:?}", result); } } @@ -944,7 +949,7 @@ pub fn ItemsList( property_labels.into_iter().map(|(property, label)| { let property_clone = property.clone(); view! { - + } }).collect::>() }}