Skip to content

fix(library): sort Saved Albums by default_sort_saved_albums when a page loads - #1099

Merged
kapok-4o merged 4 commits into
LargeModGames:mainfrom
D0ktay:prep/spotatui-1020
Nov 21, 2026
Merged

kapok-4o merged 4 commits into
LargeModGames:mainfrom
D0ktay:prep/spotatui-1020

Conversation

@D0ktay

@D0ktay D0ktay commented Nov 15, 2026 •

Copy link
Copy Markdown
Contributor

Summary

default_sort_saved_albums only seeded App.album_sort at startup, and nothing sorted the rows when a Saved Albums page arrived, so the list always opened in Spotify's order (newest saved first). store_saved_albums_page now calls sort_saved_albums() after storing the page, the same way Saved Artists and Recently Played follow their own default sort. With the built-in default value the order is unchanged (stable descending sort on added_at).

Other changes: new test stored_saved_albums_page_follows_the_default_sort and a CHANGELOG.md line under ### Fixed.

Fixes #1020

Testing

  • cargo test --no-default-features --features telemetry,tui stored_saved_albums_page_follows_the_default_sort
    test core::app::library::tests::stored_saved_albums_page_follows_the_default_sort ... ok
    test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 1960 filtered out
    
    With the sort_saved_albums() call removed, the same test fails.
  • cargo fmt --all -- --check: no output, exit 0
  • cargo clippy --no-default-features --features telemetry,tui -- -D warnings: Finished, exit 0
  • cargo test --no-default-features --features telemetry,tui: 1961 passed; 0 failed
  • git diff --exit-code tools/gates.count: exit 0

Additional notes

  • AI assistance: the first draft was written with Claude (Sonnet 5.5); I read the whole diff and ran the checks above myself.

Summary by CodeRabbit

  • Bug Fixes
    • Saved Albums now follows your configured sort order on each newly fetched or replaced page, including the default saved-album order. Albums appear in the expected order as you browse, rather than reverting to Spotify’s newest-saved-first order.

@coderabbitai

coderabbitai Bot commented Nov 15, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

Saved album pages are now sorted after storage using the configured sort. A regression test checks name sorting, and the changelog documents the change.

Changes: Saved Albums sorting

Layer / File(s) Summary
Sort stored pages
src/core/app/library.rs, CHANGELOG.md
store_saved_albums_page sorts saved albums after storing or replacing a page. A test verifies name ordering, and the changelog records that fetched pages follow the configured sort.

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

Change: Bug fix · Severity of issue fixed: Medium

Merge Risk: Minimal · up to 5e0f9

Saved Albums pages now follow the configured default sort when they load, as the linked issue asks. No actionable merge-blocking risk was found. The sort touches only the order of items within each cached page.

Pre-merge checks: Passed 4

Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title uses the conventional-commit prefix fix with the scope library, matching the repo's required format. It describes the main change: the Saved Albums page is now sorted by default_sort_saved_a…
Linked Issues check Passed Issue #1020 is the only active direct link, so its coding requirements apply. (a) Sort Saved Albums by behavior.default_sort_saved_albums after a page is stored: the whole-PR diff of src/core/app/libr…
Out of Scope Changes check Passed The library.rs diff has two hunks: the one-line sort_saved_albums() call with a comment in store_saved_albums_page, and the new test. Both implement #1020. The CHANGELOG.md diff could not be read in t…
Full details: Title check

Explanation

The title uses the conventional-commit prefix fix with the scope library, matching the repo's required format. It describes the main change: the Saved Albums page is now sorted by default_sort_saved_albums when it loads. The raw summary, objectives, and linked issue #1020 all confirm this. The title is 78 characters, which is longer than ideal for a concise subject, but it still conveys the change accurately.

Full details: Linked Issues check

Explanation

Issue #1020 is the only active direct link, so its coding requirements apply. (a) Sort Saved Albums by behavior.default_sort_saved_albums after a page is stored: the whole-PR diff of src/core/app/library.rs adds self.sort_saved_albums(); at the end of store_saved_albums_page, after the add_pages match. Met. (b) Keep per-page sorting and leave add_pages, the Settings row, and settings_apply.rs unchanged: the diff does not touch add_pages or those files. Met. (c) Add test stored_saved_albums_page_follows_the_default_sort: the diff adds it. It sets default_sort_saved_albums to name, stores a page with names Zebra, Apple, Mango, and asserts [apple, mango, zebra]. Met. (d) Keep the built-in default order unchanged: sort_saved_albums is not modified in this diff, and the existing default-sort tests are not changed. Met. The changes since the previous reviewed head add the same call, test, and changelog line, so the prior conclusion still holds. The reported fmt, clippy, full test, and gates.count results were not re-run here.

Full details: Out of Scope Changes check

Explanation

The library.rs diff has two hunks: the one-line sort_saved_albums() call with a comment in store_saved_albums_page, and the new test. Both implement #1020. The CHANGELOG.md diff could not be read in this review because the changed blob is missing from the checkout. The raw summary describes one added Unreleased entry documenting the Saved Albums default sort (+1/-0). A changelog entry is documentation for the fix and is an objective of #1020, so it is not out of scope. Its exact placement under ### Fixed is not confirmed by a diff read. The diff touches no Settings row, no settings_apply.rs, no tools/gates.count, and no src/infra/network/library.rs. No unrelated change was found.

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

Recent review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between 88fdd20 and 5e0f94e.

Files selected for processing: 1

  • CHANGELOG.md
Files skipped from review as they are similar to previous changes: 1

  • CHANGELOG.md

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

@codecov

codecov Bot commented Nov 15, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@kapok-4o kapok-4o left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. The new regression test fails on origin/main with the original album order and passes with this change. I also checked later pages, replacement pages, descending sorts and equal keys. The local format, Clippy and test checks passed, and all 130 generated GUI binding files match the committed versions.

@kapok-4o
kapok-4o merged commit 418f6b5 into LargeModGames:main Nov 21, 2026
35 checks passed
LargeModGames added a commit that referenced this pull request Nov 21, 2026
# Summary

Adds seven authors of recently merged PRs to `.all-contributorsrc` and
the README contributor table, one commit each in the all-contributors
bot format:

- polete-bermejo: code (#1116)
- Seyamalam: code (#1115)
- akshit-bansal11: code, doc (#1102, #1111)
- D0ktay: code (#1099)
- zuhairkhalid229: code (#1098)
- ViktorBystrov72: code (#1096)
- PiyushChoudhary-Git: code (#1092)

# Testing

- `jq` reads `.all-contributorsrc`: 91 contributors (84 before).
- The README table fills the last row to 7 cells and starts a new row
with the other 6.

# Additional notes

Names, avatars and profile links come from each user's public GitHub
profile, the same fields the bot uses.

---
<sub>💬 Questions or want to chat with other contributors? Join the
[spotatui Discord](https://spotatui.com/discord).</sub>

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
<!-- coderabbit-ai-generated:v1 -->

## Summary by CodeRabbit

* **Documentation**
* Updated contributor acknowledgements in the project records and
README, adding seven contributor records and six README entries.
* The README entries include code contributions and a documentation
credit.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
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.

Saved Albums ignore default_sort_saved_albums when the list loads

2 participants