Skip to content

fix: respect offline playlist sort order in player queue#830

Merged
gokadzev merged 1 commit intogokadzev:masterfrom
elias001011:fix/offline-playlist-random-order
Apr 27, 2026
Merged

fix: respect offline playlist sort order in player queue#830
gokadzev merged 1 commit intogokadzev:masterfrom
elias001011:fix/offline-playlist-random-order

Conversation

@elias001011
Copy link
Copy Markdown
Contributor

Description

This PR fixes a bug where the playback queue for "Offline Songs" would always follow the default order, ignoring any active sorting criteria (e.g., "Date Added", "Title", or "Artist").

Changes

  • Modified UserSongsPage to ensure that when a song is played (either via the main "Play" button or by tapping a specific song), the list passed to the audioHandler is correctly sorted according to the user's current selection.
  • Used the existing _sortOfflineSongsLocal and _getCurrentOfflineSortType logic to derive the sorted list before initializing the playlist payload.
  • This ensures the player queue matches the visual order of songs shown on the screen.

@gokadzev
Copy link
Copy Markdown
Owner

gokadzev commented Apr 27, 2026

@elias001011 What's the situation with online playlists? Does it handle the case correctly?

@elias001011
Copy link
Copy Markdown
Contributor Author

@gokadzev Hi! I've checked the implementation details. In PlaylistPage, the sorting logic directly modifies the _playlist['list'] object, so the audioHandler receives the already sorted list.

However, in UserSongsPage (Offline Songs), the sorting is only applied to a local variable for display purposes (_getDisplayList), while the 'Play' button and song taps still reference the original unsorted userOfflineSongs list.

My PR fixes this specifically for the offline section by ensuring the sorted list is passed to the audioHandler, matching the behavior users expect from the UI

@gokadzev
Copy link
Copy Markdown
Owner

@gokadzev Hi! I've checked the implementation details. In PlaylistPage, the sorting logic directly modifies the _playlist['list'] object, so the audioHandler receives the already sorted list.

However, in UserSongsPage (Offline Songs), the sorting is only applied to a local variable for display purposes (_getDisplayList), while the 'Play' button and song taps still reference the original unsorted userOfflineSongs list.

My PR fixes this specifically for the offline section by ensuring the sorted list is passed to the audioHandler, matching the behavior users expect from the UI

UserSongsPage is used not only for offline songs, but also recently played songs and liked songs

@elias001011
Copy link
Copy Markdown
Contributor Author

@gokadzev Hi! I've checked the implementation details. In PlaylistPage, the sorting logic directly modifies the _playlist['list'] object, so the audioHandler receives the already sorted list.

However, in UserSongsPage (Offline Songs), the sorting is only applied to a local variable for display purposes (_getDisplayList), while the 'Play' button and song taps still reference the original unsorted userOfflineSongs list.

My PR fixes this specifically for the offline section by ensuring the sorted list is passed to the audioHandler, matching the behavior users expect from the UI

UserSongsPage is used not only for offline songs, but also recently played songs and liked songs

No, the other sections (liked songs and recently played) don't have any sorting feature at all - they're just displayed in the default order. So the bug only affects offline songs because that's the only section that has sorting options. My fix specifically targets only the offline songs case and won't have any effect on the other sections since they don't have sorting functionality.

@gokadzev
Copy link
Copy Markdown
Owner

@gokadzev Hi! I've checked the implementation details. In PlaylistPage, the sorting logic directly modifies the _playlist['list'] object, so the audioHandler receives the already sorted list.
However, in UserSongsPage (Offline Songs), the sorting is only applied to a local variable for display purposes (_getDisplayList), while the 'Play' button and song taps still reference the original unsorted userOfflineSongs list.
My PR fixes this specifically for the offline section by ensuring the sorted list is passed to the audioHandler, matching the behavior users expect from the UI

UserSongsPage is used not only for offline songs, but also recently played songs and liked songs

No, the other sections (liked songs and recently played) don't have any sorting feature at all - they're just displayed in the default order. So the bug only affects offline songs because that's the only section that has sorting options. My fix specifically targets only the offline songs case and won't have any effect on the other sections since they don't have sorting functionality.

That's what I was trying to recall. Approved then. Thanks!

@gokadzev gokadzev merged commit 4f35020 into gokadzev:master Apr 27, 2026
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.

2 participants