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 {
|
||||
let feeds = use_context::<Feeds>().expect("missing feeds context");
|
||||
let params = use_params::<IdParam>();
|
||||
let id = Signal::derive(move || {
|
||||
params.get().ok().and_then(|x| x.id).unwrap_or_default()
|
||||
});
|
||||
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, false));
|
||||
let tl_url = format!("{}/context/page", Uri::api(U::Object, &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=params.get().unwrap().id.unwrap() />
|
||||
<Thread tl=feeds.context root=Uri::full(U::Object, &id.get()) />
|
||||
</div>
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,16 +7,18 @@ use crate::prelude::*;
|
|||
pub fn ObjectReplies() -> impl IntoView {
|
||||
let feeds = use_context::<Feeds>().expect("missing feeds context");
|
||||
let params = use_params::<IdParam>();
|
||||
let id = Signal::derive(move ||
|
||||
params.get().ok().and_then(|x| x.id).unwrap_or_default()
|
||||
);
|
||||
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, false));
|
||||
let tl_url = format!("{}/replies/page", Uri::api(U::Object, &id.get(), false));
|
||||
if !feeds.replies.next.get_untracked().starts_with(&tl_url) {
|
||||
feeds.replies.reset(Some(tl_url));
|
||||
}
|
||||
});
|
||||
view! {
|
||||
<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>
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue