perf: optimize UI rendering and event lifecycle

This commit is contained in:
Diocrafts
2026-02-18 10:53:43 +01:00
parent f661282962
commit 0d7c8bc019
28 changed files with 1832 additions and 766 deletions
+5 -4
View File
@@ -1,7 +1,7 @@
use chrono::{DateTime, Utc};
use serde::{Deserialize, Serialize};
use super::display_helpers::{format_file_size, mime_to_category, mime_to_icon_class, mime_to_icon_special_class};
use super::display_helpers::{format_file_size, icon_class_for, icon_special_class_for, category_for};
/// DTO for recent items, enriched with item metadata via SQL JOIN
/// so the frontend does not need N+1 requests to resolve names/sizes.
@@ -65,10 +65,11 @@ impl RecentItemDto {
self.category = "Folder".to_string();
self.size_formatted = "--".to_string();
} else {
let name = self.item_name.as_deref().unwrap_or("");
let mime = self.item_mime_type.as_deref().unwrap_or("application/octet-stream");
self.icon_class = mime_to_icon_class(mime).to_string();
self.icon_special_class = mime_to_icon_special_class(mime).to_string();
self.category = mime_to_category(mime).to_string();
self.icon_class = icon_class_for(name, mime).to_string();
self.icon_special_class = icon_special_class_for(name, mime).to_string();
self.category = category_for(name, mime).to_string();
self.size_formatted = format_file_size(self.item_size.unwrap_or(0) as u64);
}
self