From 843fee58ed9bb2a0809e5c8857746c04c62da7fc Mon Sep 17 00:00:00 2001 From: Luna Date: Thu, 9 Jul 2026 17:40:02 -0700 Subject: [PATCH] fix: show scanning state instead of empty library on cold launch MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- src/app.rs | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/src/app.rs b/src/app.rs index 8dfcc68..7a549b5 100644 --- a/src/app.rs +++ b/src/app.rs @@ -4218,6 +4218,28 @@ impl App { .sum(); 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 { self.channel_grid(ctx, ui); return;