diff --git a/web/src/page/search.rs b/web/src/page/search.rs index b81708b..30e9179 100644 --- a/web/src/page/search.rs +++ b/web/src/page/search.rs @@ -31,7 +31,10 @@ pub fn SearchPage() -> impl IntoView { move || use_query_map().get().get("q").cloned().unwrap_or_default(), move |q| { let search = format!("{URL_BASE}/search?q={q}"); - async move { Http::fetch::(&search, auth).await.ok() } + async move { + let items = Http::fetch::(&search, auth).await.ok()?; + Some(crate::timeline::process_activities(items.ordered_items().collect(), auth).await) + } } ); @@ -73,16 +76,17 @@ pub fn SearchPage() -> impl IntoView { None => Some(view! {

searching...

}.into_view()), Some(None) => None, Some(Some(items)) => Some(view! { - // TODO this is jank af! i should do the same thing i do for timelines, aka first process - // all items and store in cache and then pass a vec of strings here!!! + // TODO ughhh too many clones -
- }.into_view() + cache::OBJECTS.get(&item) + .map(|x| view! { + +
+ }.into_view() + ) } / > }.into_view()) diff --git a/web/src/timeline/mod.rs b/web/src/timeline/mod.rs index 7172510..6991f3c 100644 --- a/web/src/timeline/mod.rs +++ b/web/src/timeline/mod.rs @@ -100,7 +100,8 @@ impl Timeline { } } -async fn process_activities(activities: Vec, auth: Auth) -> Vec { +// TODO ughhh this shouldn't be here if its pub!!! +pub async fn process_activities(activities: Vec, auth: Auth) -> Vec { let mut sub_tasks : Vec>>> = Vec::new(); let mut gonna_fetch = BTreeSet::new(); let mut actors_seen = BTreeSet::new();