Optimize timeline visibility

Due to "Recursion detected" bugs in slint, we need to calculate the
layout of the timeline in Rust. This is ugly, but works.
This commit is contained in:
2026-04-26 12:02:38 +02:00
parent ab01696537
commit 10fcd546ce
3 changed files with 219 additions and 100 deletions

View File

@@ -162,6 +162,10 @@ impl Message<GetAssetThumbnail> for Api {
msg: GetAssetThumbnail,
_ctx: &mut Context<Self, Self::Reply>,
) -> Self::Reply {
if let Some(thumbnail) = self.thumbnails.get(&msg.id).cloned() {
return Ok(thumbnail);
}
let response = self
.client
.assets()
@@ -182,9 +186,13 @@ impl Message<GetAssetThumbnail> for Api {
thumbnail.height(),
);
Ok(Arc::new(AssetThumbnail {
let thumbnail = Arc::new(AssetThumbnail {
id: msg.id,
thumbnail: pixel_buffer,
}))
});
self.thumbnails.insert(msg.id, Arc::clone(&thumbnail));
Ok(thumbnail)
}
}