fix: show scanning state instead of empty library on cold launch

The desktop GUI's startup library scan runs on a background thread; on a
cold filesystem cache a large library on encrypted/compressed storage takes
~60s to walk + stat, during which the content area rendered an empty video
list. That looked like a broken/empty library and prompted a needless Rescan
(which only appeared to help because the OS cache was warm by then).

Render a centered spinner + "Scanning library…" while the initial scan is
in flight (library_load_rx still open and library empty). The scan/drain
pipeline is unchanged; this is display-only.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Luna 2026-07-09 17:40:02 -07:00
parent be5634a2f9
commit 843fee58ed
No known key found for this signature in database

View file

@ -4218,6 +4218,28 @@ impl App {
.sum(); .sum();
chips + text_w("Sort:", egui::TextStyle::Body) + spacing + 8.0 chips + text_w("Sort:", egui::TextStyle::Body) + spacing + 8.0
} }
// Initial background scan still running and nothing to show yet. A cold
// scan of a large library on encrypted/compressed storage can take a
// minute (metadata stat of every sidecar, uncached after a reboot);
// without this the content area looks like an empty/broken library and
// tempts a pointless Rescan. Show that work is in progress instead.
if self.library_load_rx.is_some() && self.library.is_empty() {
ui.vertical_centered(|ui| {
ui.add_space(ui.available_height() * 0.32);
ui.add(egui::Spinner::new().size(34.0));
ui.add_space(14.0);
ui.heading("Scanning library…");
ui.add_space(4.0);
ui.label(
egui::RichText::new(
"First launch after a reboot can take a minute on a large library.",
)
.weak(),
);
});
ctx.request_repaint(); // keep frames coming so the drain swaps in promptly
return;
}
if self.sidebar_view == SidebarView::Channels { if self.sidebar_view == SidebarView::Channels {
self.channel_grid(ctx, ui); self.channel_grid(ctx, ui);
return; return;