fix(radarr): show a loading block while the updates popup refreshes

The updates popup only checked whether its text was empty, so during a
refresh it kept rendering the previously fetched text. Opening the system
updates view dispatches a request for the update notes, so the popup could
sit on stale content until the response landed.

Guard on the loading flag as well, matching the sonarr, lidarr and readarr
updates popups, and add the loading-state test those trees have so both
halves of the condition are exercised. The pre-existing empty-updates test
never reaches the second half on its own.
This commit is contained in:
Dark-Alex-17 committed 2026-09-10 12:35:56 -06:00
1 parent 12dbbf0b1b
commit e79cc7a12d
3 files changed
+64 -1

No files matched your search

@@ -0,0 +1,48 @@
---
source: src/ui/radarr_ui/system/system_details_ui_tests.rs
expression: output
---
╭ Updates ───────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
│ │
│ │
│ Loading ... │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
+1 -1
View File
@@ -126,7 +126,7 @@ fn draw_updates_popup(f: &mut Frame<'_>, app: &mut App<'_>) {
let updates = app.data.radarr_data.updates.get_text(); let updates = app.data.radarr_data.updates.get_text();
let block = title_block("Updates"); let block = title_block("Updates");
if !updates.is_empty() { if !updates.is_empty() && !app.is_loading {
let updates_paragraph = Paragraph::new(Text::from(updates)) let updates_paragraph = Paragraph::new(Text::from(updates))
.block(borderless_block()) .block(borderless_block())
.scroll((app.data.radarr_data.updates.offset, 0)); .scroll((app.data.radarr_data.updates.offset, 0));
@@ -87,6 +87,21 @@ mod tests {
insta::assert_snapshot!(output); insta::assert_snapshot!(output);
} }
#[test]
fn test_system_details_ui_updates_popup_is_loading_when_updates_are_present() {
let mut app = App::test_default_fully_populated();
app.is_loading = true;
app.push_navigation_stack(ActiveRadarrBlock::SystemUpdates.into());
assert!(!app.data.radarr_data.updates.get_text().is_empty());
let output = render_to_string_with_app(TerminalSize::Large, &mut app, |f, app| {
SystemDetailsUi::draw(f, app, f.area());
});
insta::assert_snapshot!(output);
}
#[test] #[test]
fn test_system_details_ui_renders_updates_loading_when_empty() { fn test_system_details_ui_renders_updates_loading_when_empty() {
let mut app = App::test_default_fully_populated(); let mut app = App::test_default_fully_populated();