diff --git a/web/src/page/object.rs b/web/src/page/object.rs index 01e7247..ca4d7cd 100644 --- a/web/src/page/object.rs +++ b/web/src/page/object.rs @@ -12,8 +12,13 @@ pub fn ObjectPage(tl: Timeline) -> impl IntoView { 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 { + let object = create_local_resource( + move || params.get().get("id").cloned().unwrap_or_default(), + move |oid| async move { + let tl_url = format!("{}/page", Uri::api(U::Context, &oid, false)); + if !tl.next.get().starts_with(&tl_url) { + tl.reset(tl_url); + } match CACHE.get(&Uri::full(U::Object, &oid)) { Some(x) => Some(x.clone()), None => { @@ -31,7 +36,7 @@ pub fn ObjectPage(tl: Timeline) -> impl IntoView { } } } - }); + ); view! {
@@ -55,10 +60,6 @@ pub fn ObjectPage(tl: Timeline) -> impl IntoView { }, Some(Some(o)) => { let object = o.clone(); - let tl_url = format!("{}/page", Uri::api(U::Context, &o.context().id().unwrap_or_default(), false)); - if !tl.next.get().starts_with(&tl_url) { - tl.reset(tl_url); - } view!{
diff --git a/web/src/page/user.rs b/web/src/page/user.rs index 6bafae1..1228511 100644 --- a/web/src/page/user.rs +++ b/web/src/page/user.rs @@ -32,6 +32,10 @@ pub fn UserPage(tl: Timeline) -> impl IntoView { move || params.get().get("id").cloned().unwrap_or_default(), move |id| { async move { + let tl_url = format!("{}/outbox/page", Uri::api(U::Actor, &id, false)); + if !tl.next.get().starts_with(&tl_url) { + tl.reset(tl_url); + } match CACHE.get(&Uri::full(U::Actor, &id)) { Some(x) => Some(x.clone()), None => { @@ -82,10 +86,6 @@ pub fn UserPage(tl: Timeline) -> impl IntoView { let following = object.following_count().unwrap_or(0); let followers = object.followers_count().unwrap_or(0); let statuses = object.statuses_count().unwrap_or(0); - let tl_url = format!("{}/outbox/page", Uri::api(U::Actor, &id.clone(), false)); - if !tl.next.get().starts_with(&tl_url) { - tl.reset(tl_url); - } let following_me = object.following_me().unwrap_or(false); let followed_by_me = object.followed_by_me().unwrap_or(false); let _uid = uid.clone();