From ad7c643762a134280bf61fdbede44162405657c1 Mon Sep 17 00:00:00 2001 From: alemi Date: Fri, 7 Jun 2024 05:03:12 +0200 Subject: [PATCH] fix(web): leptos warnings --- web/src/page/object.rs | 7 +++---- web/src/page/user.rs | 2 +- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/web/src/page/object.rs b/web/src/page/object.rs index bb143f6..8a362a9 100644 --- a/web/src/page/object.rs +++ b/web/src/page/object.rs @@ -10,8 +10,6 @@ use apb::{Base, Object}; pub fn ObjectPage(tl: Timeline) -> impl IntoView { let params = use_params_map(); let auth = use_context::().expect("missing auth context"); - let id = params.get().get("id").cloned().unwrap_or_default(); - let uid = uriproxy::uri(URL_BASE, uriproxy::UriClass::Object, &id); let object = create_local_resource( move || params.get().get("id").cloned().unwrap_or_default(), move |oid| async move { @@ -38,7 +36,7 @@ pub fn ObjectPage(tl: Timeline) -> impl IntoView { }; if let Ok(ctx) = obj.context().id() { let tl_url = format!("{}/context/page", Uri::api(U::Object, ctx, false)); - if !tl.next.get().starts_with(&tl_url) { + if !tl.next.get_untracked().starts_with(&tl_url) { tl.reset(tl_url); } } @@ -64,7 +62,8 @@ pub fn ObjectPage(tl: Timeline) -> impl IntoView { {move || match object.get() { None => view! {

loading ...

}.into_view(), Some(None) => { - let uid = uid.clone(); + let raw_id = params.get().get("id").cloned().unwrap_or_default(); + let uid = uriproxy::uri(URL_BASE, uriproxy::UriClass::Object, &raw_id); view! {

loading failed"↗"

}.into_view() }, Some(Some(o)) => { diff --git a/web/src/page/user.rs b/web/src/page/user.rs index 68bcb9a..32316ab 100644 --- a/web/src/page/user.rs +++ b/web/src/page/user.rs @@ -33,7 +33,7 @@ pub fn UserPage(tl: Timeline) -> impl IntoView { move |id| { async move { let tl_url = format!("{}/outbox/page", Uri::api(U::Actor, &id, false)); - if !tl.next.get().starts_with(&tl_url) { + if !tl.next.get_untracked().starts_with(&tl_url) { tl.reset(tl_url); } match CACHE.get(&Uri::full(U::Actor, &id)) {