fix(web): change tl url not root id
This commit is contained in:
parent
284f1023a4
commit
5c94e37937
1 changed files with 8 additions and 7 deletions
|
@ -8,25 +8,26 @@ 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()
|
let id = params.get().ok()
|
||||||
.and_then(|x| x.id)
|
.and_then(|x| x.id)
|
||||||
.unwrap_or_default()
|
.unwrap_or_default();
|
||||||
);
|
Uri::full(U::Object, &id)
|
||||||
|
});
|
||||||
let context_id = Signal::derive(move ||
|
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())
|
.and_then(|x| x.context().id().ok())
|
||||||
.unwrap_or_default()
|
.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, &context_id.get(), false));
|
||||||
if !feeds.context.next.get_untracked().starts_with(&tl_url) {
|
if !feeds.context.next.get_untracked().starts_with(&tl_url) {
|
||||||
feeds.context.reset(Some(tl_url));
|
feeds.context.reset(Some(tl_url));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
view! {
|
view! {
|
||||||
<div class="mr-1-r ml-1-r">
|
<div class="mr-1-r ml-1-r">
|
||||||
<Thread tl=feeds.context root=context_id.get() />
|
<Thread tl=feeds.context root=id.get() />
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue