Skip to content

fix(tui): draw an empty titled table while library sections load - #620

Merged
LargeModGames merged 1 commit into
LargeModGames:mainfrom
chiliec:fix/610-empty-titled-tables
Sep 27, 2026
Merged

LargeModGames merged 1 commit into
LargeModGames:mainfrom
chiliec:fix/610-empty-titled-tables

Conversation

@chiliec

@chiliec chiliec commented Sep 27, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Closes #610.

draw_album_list, draw_podcast_table, draw_recently_played_table and draw_show_episodes each drew nothing while their data was still None, so the pane had no border, title or header until the first page arrived (and stayed blank if the fetch failed). Each now has an else branch that calls draw_table with &[], offset 0, the same title and the same selected index, following draw_artist_table.

  • draw_recently_played_table: current_route, highlight_state and selected_song_index moved above the if let so the else branch can use them.
  • draw_show_episodes: the title match moved above the if let, so the empty pane still names the show.
  • draw_album_table and App / app.view are untouched.

Tests: rendered now delegates to a rendered_with(app, area, draw) helper. Four new tests render each fn from App::default() into Rect::new(0, 0, 80, 8) and check for the title (Saved Albums, Podcasts, Recently Played Tracks, Episodes). test_attribute_total in tools/gates.count goes from 2296 to 2300. There's also a CHANGELOG entry under Unreleased → Fixed.

Testing

Run locally on Linux with rustc 1.98.1:

  • cargo test --no-default-features --features telemetry,tui empty_titled_table before the fix, with only the tests added: 0 passed; 4 failed (all four new tests)
  • The same command after the fix: 4 passed; 0 failed; 1265 filtered out
  • cargo fmt --all -- --check: clean (exit 0)
  • cargo clippy --no-default-features --features telemetry,tui -- -D warnings: finished, no warnings (exit 0)
  • cargo test --no-default-features --features telemetry,tui: 1269 passed; 0 failed, gates test included

Additional notes

I didn't attach a screenshot because the change is only visible before data loads. The TestBackend tests cover it.

Summary by CodeRabbit

  • Bug Fixes
    • Podcast, saved album, episode, and recently played tables now show their titles while content is loading or unavailable, instead of disappearing.

@coderabbitai

coderabbitai Bot commented Sep 27, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository: LargeModGames/spotatui/.coderabbit.yaml

Review profile: CHILL

Plan: Advanced

Run ID: e1a94122-3be8-4198-952b-ccbb9adf0c85

📥 Commits

Reviewing files that changed from the base of the PR and between f3b0c7f and 4fa11a9.

📒 Files selected for processing (3)
  • CHANGELOG.md
  • src/tui/ui/tables.rs
  • tools/gates.count

Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 3 remain after this review.


📝 Walkthrough

Walkthrough

Podcast, saved album, episode, and recently played tables now display their titles when data is unavailable. The episode table title retains the selected show name and publisher, or uses “Episodes” when no show is selected. Tests cover the four empty tables.

Changes

Empty table rendering

Layer / File(s) Summary
Render tables without data
src/tui/ui/tables.rs, CHANGELOG.md, tools/gates.count
The four table functions draw titled tables when their data is unavailable. Episode titles retain the selected show context. Tests check each table title. The changelog records the display change, and the test attribute baseline increases from 2296 to 2300.

Priority: ➖ Normal

Estimated code review effort: 2 (Simple) | ~8 minutes

Change: Bug fix

Merge Risk: ⚪ Minimal · up to 4fa11

The tables now display titles while data is unavailable, with no identified issue requiring a fix before merge.

Architecture Summary

Architecture risk: 🟠 High · up to 4fa11

The change affects 3 systems.

Changed systems: src, CHANGELOG.md, tools

Architecture concerns
No architecture-level concerns identified.

Review details

Systems and components

  • observed — src (ui) was modified; 1 changed file maps to changed impact.
  • observed — CHANGELOG.md (service) was modified; 1 changed file maps to changed impact.
  • observed — tools (service) was modified; 1 changed file maps to changed impact.

Before / after behavior

  • observed — Modified behavior in CHANGELOG.md: Adds an Unreleased fix entry describing the loading and failed-fetch display for Albums, Podcasts, and Recently Played.
  • observed — Modified behavior in src/tui/ui/tables.rs: draw_podcast_table now renders an empty “Podcasts” table with selection index and highlight state when saved-show data is unavailable; previously the missing-data branch returned without drawing.
  • observed — Modified behavior in src/tui/ui/tables.rs: draw_album_list now renders an empty “Saved Albums” table when saved-album data is unavailable; previously the missing-data branch returned without drawing.
  • observed — Modified behavior in src/tui/ui/tables.rs: draw_show_episodes now computes the selected-show title before checking for episode data, preserving the show name and publisher (or “Episodes” when no show is selected) for both loaded and unloaded states.

Reliability and maintainability

  • inferred — Risk-relevant change factors for src: blast_radius_4; blast_radius_7; direct_dependents_2; direct_dependents_4
🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title uses the allowed fix(tui): prefix and clearly describes the main change: drawing an empty titled table while library sections load.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create a new PR
✨ Simplify code
  • Create a new PR

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@codecov

codecov Bot commented Sep 27, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 91.89189% with 6 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
src/tui/ui/tables.rs 91.8% 6 Missing ⚠️

📢 Thoughts on this report? Let us know!

@LargeModGames
LargeModGames merged commit acccae3 into LargeModGames:main Sep 27, 2026
31 checks passed
@LargeModGames

Copy link
Copy Markdown
Owner

@all-contributors please add @chiliec for code

@allcontributors

Copy link
Copy Markdown
Contributor

@LargeModGames

I've put up a pull request to add @chiliec! 🎉

LargeModGames pushed a commit that referenced this pull request Sep 27, 2026
Adds @chiliec as a contributor for code.

This was requested by LargeModGames [in this
comment](#620 (comment))

[skip ci]

---------

Co-authored-by: allcontributors[bot] <46447321+allcontributors[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Albums, Podcasts and Recently Played draw a blank pane until loaded

2 participants