fix(web): change tl url not root id

This commit is contained in:
əlemi 2024-11-20 23:18:13 +01:00
parent 284f1023a4
commit 5c94e37937
Signed by: alemi
GPG key ID: A4895B84D311642C

View file

@ -8,25 +8,26 @@ use crate::prelude::*;
pub fn ObjectContext() -> impl IntoView {
let feeds = use_context::<Feeds>().expect("missing feeds context");
let params = use_params::<IdParam>();
let id = Signal::derive(move ||
params.get().ok()
let id = Signal::derive(move || {
let id = params.get().ok()
.and_then(|x| x.id)
.unwrap_or_default()
);
.unwrap_or_default();
Uri::full(U::Object, &id)
});
let context_id = Signal::derive(move ||
cache::OBJECTS.get(&Uri::full(U::Object, &id.get()))
cache::OBJECTS.get(&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));
let tl_url = format!("{}/context/page", Uri::api(U::Object, &context_id.get(), false));
if !feeds.context.next.get_untracked().starts_with(&tl_url) {
feeds.context.reset(Some(tl_url));
}
});
view! {
<div class="mr-1-r ml-1-r">
<Thread tl=feeds.context root=context_id.get() />
<Thread tl=feeds.context root=id.get() />
</div>
}
}