diff --git a/src/app.rs b/src/app.rs
index 367b918..7a13fad 100644
--- a/src/app.rs
+++ b/src/app.rs
@@ -31,31 +31,31 @@ pub fn App() -> impl IntoView {
view! {
- {
- set_items.set(loaded_items);
- }
- Err(err) => log!("Error loading items: {}", err),
+ // Proper async handling
+ spawn_local({
+ let current_url = current_url.clone();
+ async move {
+ match load_items_from_db(¤t_url()).await {
+ Ok(items) => set_items.set(items),
+ Err(e) => log!("Error loading items: {}", e),
}
- });
- });
- view! {
-
-
-
-
{ "CompareWare" }
-
-
}
+ });
+ view! {
+
+
+
+
{ "CompareWare" }
+
+
+ }
}/>
diff --git a/src/components/items_list.rs b/src/components/items_list.rs
index 03cb121..4711230 100644
--- a/src/components/items_list.rs
+++ b/src/components/items_list.rs
@@ -66,6 +66,7 @@ pub async fn load_items_from_db(current_url: &str) -> Result, String>
#[component]
pub fn ItemsList(
+ url: String,
items: ReadSignal>,
set_items: WriteSignal>,
) -> impl IntoView {