fix(web): context and replies root id
This commit is contained in:
parent
63e1e1f440
commit
ae85351b11
2 changed files with 10 additions and 6 deletions
|
@ -7,16 +7,18 @@ 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 || {
|
||||||
|
params.get().ok().and_then(|x| x.id).unwrap_or_default()
|
||||||
|
});
|
||||||
create_effect(move |_| {
|
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.get(), false));
|
||||||
let tl_url = format!("{}/context/page", Uri::api(U::Object, &id, 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=params.get().unwrap().id.unwrap() />
|
<Thread tl=feeds.context root=Uri::full(U::Object, &id.get()) />
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,16 +7,18 @@ use crate::prelude::*;
|
||||||
pub fn ObjectReplies() -> impl IntoView {
|
pub fn ObjectReplies() -> 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 ||
|
||||||
|
params.get().ok().and_then(|x| x.id).unwrap_or_default()
|
||||||
|
);
|
||||||
create_effect(move |_| {
|
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.get(), false));
|
||||||
let tl_url = format!("{}/replies/page", Uri::api(U::Object, &id, false));
|
|
||||||
if !feeds.replies.next.get_untracked().starts_with(&tl_url) {
|
if !feeds.replies.next.get_untracked().starts_with(&tl_url) {
|
||||||
feeds.replies.reset(Some(tl_url));
|
feeds.replies.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.replies root=params.get().unwrap().id.unwrap() />
|
<Thread tl=feeds.replies root=Uri::full(U::Object, &id.get()) />
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue