From ae85351b115a14108702e1aac379714cc011e6ae Mon Sep 17 00:00:00 2001 From: alemi Date: Mon, 11 Nov 2024 00:40:39 +0100 Subject: [PATCH] fix(web): context and replies root id --- web/src/objects/context.rs | 8 +++++--- web/src/objects/replies.rs | 8 +++++--- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/web/src/objects/context.rs b/web/src/objects/context.rs index cfecbb1..dec9a4d 100644 --- a/web/src/objects/context.rs +++ b/web/src/objects/context.rs @@ -7,16 +7,18 @@ use crate::prelude::*; pub fn ObjectContext() -> impl IntoView { let feeds = use_context::().expect("missing feeds context"); let params = use_params::(); + let id = Signal::derive(move || { + params.get().ok().and_then(|x| x.id).unwrap_or_default() + }); create_effect(move |_| { - let id = params.get().ok().and_then(|x| x.id).unwrap_or_default(); - let tl_url = format!("{}/context/page", Uri::api(U::Object, &id, false)); + let tl_url = format!("{}/context/page", Uri::api(U::Object, &id.get(), false)); if !feeds.context.next.get_untracked().starts_with(&tl_url) { feeds.context.reset(Some(tl_url)); } }); view! {
- +
} } diff --git a/web/src/objects/replies.rs b/web/src/objects/replies.rs index 1769ade..8e4838e 100644 --- a/web/src/objects/replies.rs +++ b/web/src/objects/replies.rs @@ -7,16 +7,18 @@ use crate::prelude::*; pub fn ObjectReplies() -> impl IntoView { let feeds = use_context::().expect("missing feeds context"); let params = use_params::(); + let id = Signal::derive(move || + params.get().ok().and_then(|x| x.id).unwrap_or_default() + ); create_effect(move |_| { - let id = params.get().ok().and_then(|x| x.id).unwrap_or_default(); - let tl_url = format!("{}/replies/page", Uri::api(U::Object, &id, false)); + let tl_url = format!("{}/replies/page", Uri::api(U::Object, &id.get(), false)); if !feeds.replies.next.get_untracked().starts_with(&tl_url) { feeds.replies.reset(Some(tl_url)); } }); view! {
- +
} }