fix(web): follows/followers from newer to older

This commit is contained in:
əlemi 2024-07-03 04:32:29 +02:00
parent 04ad3c84c2
commit b6f4539424
Signed by: alemi
GPG key ID: A4895B84D311642C

View file

@ -32,22 +32,28 @@ pub fn FollowList(outgoing: bool) -> impl IntoView {
{move || match resource.get() {
None => view! { <Loader /> }.into_view(),
Some(Err(e)) => view! { <p class="center">could not load {follow___}: {e}</p> }.into_view(),
Some(Ok(arr)) => view! {
<For
each=move || arr.clone()
key=|id| id.clone()
children=move |id| {
let actor = match cache::OBJECTS.get(&id) {
Some(x) => x,
None => Arc::new(serde_json::Value::String(id)),
};
view! {
<ActorBanner object=actor />
<hr />
}.into_view()
}
/ >
}.into_view(),
Some(Ok(mut arr)) => {
// TODO cheap fix: server gives us follows from oldest to newest
// but it's way more convenient to have them other way around
// so we reverse them just after loading them
arr.reverse();
view! {
<For
each=move || arr.clone()
key=|id| id.clone()
children=move |id| {
let actor = match cache::OBJECTS.get(&id) {
Some(x) => x,
None => Arc::new(serde_json::Value::String(id)),
};
view! {
<ActorBanner object=actor />
<hr />
}.into_view()
}
/ >
}.into_view()
},
}}
</div>
}