Skip to content

Commit

Permalink
Don't try to sort while loading to avoid incorrect load order
Browse files Browse the repository at this point in the history
  • Loading branch information
kraxarn committed Dec 23, 2023
1 parent 4fd3836 commit 2d8afd6
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/list/tracks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -533,8 +533,6 @@ auto List::Tracks::load(const lib::spt::page<lib::spt::track> &page,
// Hide until track with date is inserted
header()->setSectionHidden(addedColumn, true);

setSortingEnabled(false);

for (size_t i = 0; i < page.items.size(); i++)
{
const auto index = page.offset + static_cast<int>(i);
Expand Down Expand Up @@ -583,8 +581,6 @@ auto List::Tracks::load(const lib::spt::page<lib::spt::track> &page,
}
}

setSortingEnabled(true);

if (page.has_next())
{
return true;
Expand Down Expand Up @@ -614,7 +610,9 @@ void List::Tracks::load(const std::vector<lib::spt::track> &tracks,
page.items = tracks;
page.total = static_cast<int>(tracks.size());

setSortingEnabled(false);
load(page, selectedId, addedAt);
setSortingEnabled(true);
}

void List::Tracks::load(const std::vector<lib::spt::track> &tracks)
Expand Down Expand Up @@ -692,6 +690,7 @@ void List::Tracks::refreshPlaylist(const lib::spt::playlist &playlist)
}

refreshing = true;
setSortingEnabled(false);

spotify.playlist_tracks(playlist,
[this, mainWindow, playlist, playlistUri]
Expand All @@ -718,6 +717,7 @@ void List::Tracks::refreshPlaylist(const lib::spt::playlist &playlist)
}

refreshing = false;
setSortingEnabled(true);
saveToCache(playlist);
setEnabled(true);
return false;
Expand Down

0 comments on commit 2d8afd6

Please sign in to comment.