Skip to content

fix(playlist): refetch stale tracks when clearing search - #786

Merged
LargeModGames merged 3 commits into
LargeModGames:mainfrom
theluckystrike:fix/clear-playlist-filter-stale-cache
Oct 13, 2026
Merged

LargeModGames merged 3 commits into
LargeModGames:mainfrom
theluckystrike:fix/clear-playlist-filter-stale-cache

Conversation

@theluckystrike

@theluckystrike theluckystrike commented Oct 13, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #785.

Fixes the playlist bug where clearing a search brought back a track you'd removed. The paired issue is #785.

The filter clear path is clear_playlist_track_filter. It used to restore the unfiltered table straight from the playlist's loaded pages, and a remove leaves those pages out of date. Now, when the pages are out of date, it reloads the playlist through the existing reset_playlist_tracks_view boundary and walks Spotify from the first page instead of restoring them. The fetch responses rebuild the table through the one existing set_playlist_tracks_to_table_continuous path, so there's no new fetch response handling and no UI change.

I added a regression that drives the real App and cache state. It fails on the old path with the stale cached rows message and passes with the fix, and it needs no Spotify login because it uses a fake event channel. I didn't touch the network remove path.

Testing

I ran cargo test --no-default-features --features telemetry,tui, which passed 1553 tests. I also ran cargo fmt --all -- --check and cargo clippy --no-default-features --features telemetry,tui -- -D warnings, both clean. I only tested the slim telemetry,tui feature set locally, so I'm not claiming the wider CI feature matrix.

The test output was 1553 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out. The format check returned exit 0 with no output, and Clippy returned exit 0.

Summary by CodeRabbit

  • Bug Fixes
    • Clearing a playlist search now reloads from the first page when cached results may be outdated, rather than showing stale tracks.

A remove marks the cached playlist pages stale but never refreshes the
visible table, so clearing an active search restored the rows from before
the search, the removed track included. When the cached pages are stale,
clearing the filter now reopens the table and walks Spotify from the first
page instead of restoring them.

Adds an App-level regression that fails on the old restore path.
Adds one Unreleased Fixed entry for the playlist filter-clear reload.
Only the changelog; the code fix and its test are unchanged.
@coderabbitai

coderabbitai Bot commented Oct 13, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

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: c99a58b8-9843-402f-bb99-1addd4eeed8d
📥 Commits

Reviewing files that changed from the base of the PR and between 06e7a1c and 4dc696f.

📒 Files selected for processing (2)
  • CHANGELOG.md
  • src/core/app/playlist_pages.rs

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

Clearing a playlist filter now refetches the active playlist from offset 0 when its cached pages are stale. A regression test checks that the stale rows are not restored and that the first-page request is issued.

Changes: Playlist track refresh

Layer / File(s) Summary
Stale-page refetch and validation
src/core/app/playlist_pages.rs, CHANGELOG.md
When cached pages are stale, clearing the filter resets the view and requests playlist items from offset 0. The test checks that the table remains empty, the cache is cleared, and the request uses the active playlist ID. The changelog records the fix.

Priority: ➖ Normal

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

Change: Bug fix · Severity of issue fixed: Medium

Merge Risk: ⚪ Minimal · up to 4dc69

No identified issue currently blocks merging the playlist filter fix after normal checks.

Pre-merge checks · Passed 4
Passed Passed checks (4 passed)
Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title uses the valid conventional-commit prefix fix(playlist):, clearly describes the stale-track refetch behavior, and remains concise and imperative.
Linked Issues check Passed Issue #785 requires clearing a playlist search to show current playlist contents after a remove. In src/core/app/playlist_pages.rs, clear_playlist_track_filter detects stale playlist pages and cal…
Out of Scope Changes check Passed The changes are limited to the #785 filter-clear path, its regression test, and a related Unreleased changelog entry. The test supports the issue objective. The changelog documents the fix. No unrelat…
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create a new PR
✨ Simplify code
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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 Oct 13, 2026

Copy link
Copy Markdown

Codecov Report

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

Files with missing lines Patch % Lines
src/core/app/playlist_pages.rs 91.8% 3 Missing ⚠️

📢 Thoughts on this report? Let us know!

@LargeModGames
LargeModGames merged commit c2a3a9d into LargeModGames:main Oct 13, 2026
32 checks passed
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.

Clearing a playlist search restores rows from before a remove

2 participants