fix(web): leptos warnings

This commit is contained in:
əlemi 2024-06-07 05:03:12 +02:00
parent 116c8fe6b0
commit ad7c643762
Signed by: alemi
GPG key ID: A4895B84D311642C
2 changed files with 4 additions and 5 deletions

View file

@ -10,8 +10,6 @@ use apb::{Base, Object};
pub fn ObjectPage(tl: Timeline) -> impl IntoView { pub fn ObjectPage(tl: Timeline) -> impl IntoView {
let params = use_params_map(); let params = use_params_map();
let auth = use_context::<Auth>().expect("missing auth context"); let auth = use_context::<Auth>().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( let object = create_local_resource(
move || params.get().get("id").cloned().unwrap_or_default(), move || params.get().get("id").cloned().unwrap_or_default(),
move |oid| async move { move |oid| async move {
@ -38,7 +36,7 @@ pub fn ObjectPage(tl: Timeline) -> impl IntoView {
}; };
if let Ok(ctx) = obj.context().id() { if let Ok(ctx) = obj.context().id() {
let tl_url = format!("{}/context/page", Uri::api(U::Object, ctx, false)); 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); tl.reset(tl_url);
} }
} }
@ -64,7 +62,8 @@ pub fn ObjectPage(tl: Timeline) -> impl IntoView {
{move || match object.get() { {move || match object.get() {
None => view! { <p class="center"> loading ... </p> }.into_view(), None => view! { <p class="center"> loading ... </p> }.into_view(),
Some(None) => { 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! { <p class="center"><code>loading failed</code><sup><small><a class="clean" href={uid} target="_blank">""</a></small></sup></p> }.into_view() view! { <p class="center"><code>loading failed</code><sup><small><a class="clean" href={uid} target="_blank">""</a></small></sup></p> }.into_view()
}, },
Some(Some(o)) => { Some(Some(o)) => {

View file

@ -33,7 +33,7 @@ pub fn UserPage(tl: Timeline) -> impl IntoView {
move |id| { move |id| {
async move { async move {
let tl_url = format!("{}/outbox/page", Uri::api(U::Actor, &id, false)); 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); tl.reset(tl_url);
} }
match CACHE.get(&Uri::full(U::Actor, &id)) { match CACHE.get(&Uri::full(U::Actor, &id)) {