1
0
Fork 0
forked from alemi/upub

fix(web): also cache user when viewing object

not the cleanest way to do it but eh works
This commit is contained in:
əlemi 2024-05-12 02:44:27 +02:00
parent 8a36e91fde
commit 26f94cb0de
Signed by: alemi
GPG key ID: A4895B84D311642C

View file

@ -267,6 +267,13 @@ pub fn ObjectPage(tl: Timeline) -> impl IntoView {
None => { None => {
let obj = Http::fetch::<serde_json::Value>(&Uri::api(FetchKind::Object, &oid, true), auth).await.ok()?; let obj = Http::fetch::<serde_json::Value>(&Uri::api(FetchKind::Object, &oid, true), auth).await.ok()?;
let obj = Arc::new(obj); let obj = Arc::new(obj);
if let Some(author) = obj.attributed_to().id() {
if let Ok(user) = Http::fetch::<serde_json::Value>(
&Uri::api(FetchKind::User, &author, true), auth
).await {
CACHE.put(Uri::full(FetchKind::User, &author), Arc::new(user));
}
}
CACHE.put(Uri::full(FetchKind::Object, &oid), obj.clone()); CACHE.put(Uri::full(FetchKind::Object, &oid), obj.clone());
Some(obj) Some(obj)
} }