fix(item_list):initialize with one empty item if the database is empty
This commit is contained in:
parent
68b458df5e
commit
ac8eb8118d
1 changed files with 12 additions and 1 deletions
|
@ -53,7 +53,18 @@ pub fn ItemsList(
|
|||
match load_items_from_db().await {
|
||||
Ok(loaded_items) => {
|
||||
// Set the loaded items
|
||||
if loaded_items.is_empty() {
|
||||
// Initialize with one empty item if the database is empty
|
||||
set_items.set(vec![Item {
|
||||
id: Uuid::new_v4().to_string(),
|
||||
name: String::new(),
|
||||
description: String::new(),
|
||||
wikidata_id: None,
|
||||
custom_properties: HashMap::new(),
|
||||
}]);
|
||||
} else {
|
||||
set_items.set(loaded_items.clone());
|
||||
}
|
||||
|
||||
// Derive selected properties from the loaded items
|
||||
let mut selected_props = HashMap::new();
|
||||
|
|
Loading…
Add table
Reference in a new issue