fix(web): context should work in replies too
This commit is contained in:
parent
5f998e9773
commit
284f1023a4
1 changed files with 12 additions and 4 deletions
|
@ -1,3 +1,4 @@
|
||||||
|
use apb::Object;
|
||||||
use leptos::*;
|
use leptos::*;
|
||||||
use leptos_router::*;
|
use leptos_router::*;
|
||||||
use crate::prelude::*;
|
use crate::prelude::*;
|
||||||
|
@ -7,9 +8,16 @@ use crate::prelude::*;
|
||||||
pub fn ObjectContext() -> impl IntoView {
|
pub fn ObjectContext() -> impl IntoView {
|
||||||
let feeds = use_context::<Feeds>().expect("missing feeds context");
|
let feeds = use_context::<Feeds>().expect("missing feeds context");
|
||||||
let params = use_params::<IdParam>();
|
let params = use_params::<IdParam>();
|
||||||
let id = Signal::derive(move || {
|
let id = Signal::derive(move ||
|
||||||
params.get().ok().and_then(|x| x.id).unwrap_or_default()
|
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 |_| {
|
create_effect(move |_| {
|
||||||
let tl_url = format!("{}/context/page", Uri::api(U::Object, &id.get(), false));
|
let tl_url = format!("{}/context/page", Uri::api(U::Object, &id.get(), false));
|
||||||
if !feeds.context.next.get_untracked().starts_with(&tl_url) {
|
if !feeds.context.next.get_untracked().starts_with(&tl_url) {
|
||||||
|
@ -18,7 +26,7 @@ pub fn ObjectContext() -> impl IntoView {
|
||||||
});
|
});
|
||||||
view! {
|
view! {
|
||||||
<div class="mr-1-r ml-1-r">
|
<div class="mr-1-r ml-1-r">
|
||||||
<Thread tl=feeds.context root=Uri::full(U::Object, &id.get()) />
|
<Thread tl=feeds.context root=context_id.get() />
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue