From 297b7b29095d3b711ceb749170799208bff64882 Mon Sep 17 00:00:00 2001 From: Christopher Snowhill Date: Fri, 21 Jan 2022 00:16:29 -0800 Subject: [PATCH] Playlist View: Fix default sorting and playlist refreshing, which fixes playlist search bugging out --- Playlist/PlaylistController.m | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Playlist/PlaylistController.m b/Playlist/PlaylistController.m index b4bb516e2..b08b91cf4 100644 --- a/Playlist/PlaylistController.m +++ b/Playlist/PlaylistController.m @@ -109,6 +109,9 @@ static NSArray * cellIdentifiers = nil; statusImageTransformer = [NSValueTransformer valueTransformerForName:@"StatusImageTransformer"]; + NSSortDescriptor *sortDescriptor = [[NSSortDescriptor alloc] initWithKey:@"index" ascending:YES]; + [self.tableView setSortDescriptors:@[sortDescriptor]]; + [self addObserver:self forKeyPath:@"arrangedObjects" options:(NSKeyValueObservingOptionNew | NSKeyValueObservingOptionOld) @@ -123,6 +126,7 @@ static NSArray * cellIdentifiers = nil; if ([keyPath isEqualToString:@"arrangedObjects"]) { [self updatePlaylistIndexes]; [self updateTotalTime]; + [self.tableView reloadData]; } else if ([keyPath isEqualToString:@"values.fontSize"]) { [self updateRowSize];