Skip to content

Commit cb806d9

Browse files
committed
fix: clear sort order after reversing playlist
1 parent a6c3fd9 commit cb806d9

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

src/model/playlist.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,10 +99,15 @@ impl Playlist {
9999
}
100100
}
101101

102-
pub fn reverse(&mut self) {
102+
pub fn reverse(&mut self, library: &Library) {
103103
if let Some(tracks) = &mut self.tracks {
104104
tracks.reverse();
105105
}
106+
107+
// Clear any stored sort order for this playlist
108+
library.cfg.with_state_mut(|state| {
109+
state.playlist_orders.remove(&self.id);
110+
});
106111
}
107112

108113
pub fn sort(&mut self, key: &SortKey, direction: &SortDirection) {

src/ui/playlist.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ impl ViewExt for PlaylistView {
114114
}
115115

116116
if let Command::Reverse = cmd {
117-
self.playlist.reverse();
117+
self.playlist.reverse(&self.library);
118118
let tracks = self.playlist.tracks.as_ref().unwrap_or(&Vec::new()).clone();
119119
self.list = ListView::new(
120120
Arc::new(RwLock::new(tracks)),

0 commit comments

Comments
 (0)