From 284f1023a44e78e0c73e3ef8767ab07b06de95fc Mon Sep 17 00:00:00 2001 From: alemi Date: Wed, 20 Nov 2024 23:05:09 +0100 Subject: [PATCH] fix(web): context should work in replies too --- web/src/objects/context.rs | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/web/src/objects/context.rs b/web/src/objects/context.rs index dec9a4d..5ab4c9f 100644 --- a/web/src/objects/context.rs +++ b/web/src/objects/context.rs @@ -1,3 +1,4 @@ +use apb::Object; use leptos::*; use leptos_router::*; use crate::prelude::*; @@ -7,9 +8,16 @@ 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() - }); + let id = Signal::derive(move || + params.get().ok() + .and_then(|x| x.id) + .unwrap_or_default() + ); + let context_id = Signal::derive(move || + cache::OBJECTS.get(&Uri::full(U::Object, &id.get())) + .and_then(|x| x.context().id().ok()) + .unwrap_or_default() + ); create_effect(move |_| { let tl_url = format!("{}/context/page", Uri::api(U::Object, &id.get(), false)); if !feeds.context.next.get_untracked().starts_with(&tl_url) { @@ -18,7 +26,7 @@ pub fn ObjectContext() -> impl IntoView { }); view! {
- +
} }