Skip to content

Commit c4d73f9

Browse files
committed
fix: clear sort order after reversing playlist
1 parent db5a9c6 commit c4d73f9

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
@@ -100,10 +100,15 @@ impl Playlist {
100100
}
101101
}
102102

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

109114
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)