Skip to content

Commit

Permalink
Merge pull request ppy#30385 from peppy/fix-selection-lost-during-update
Browse files Browse the repository at this point in the history
Fix beatmap selection being lost during update process
  • Loading branch information
peppy authored Oct 22, 2024
2 parents 3158338 + e1a950e commit 7b3376c
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions osu.Game/Screens/Select/BeatmapCarousel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -322,6 +322,11 @@ private void processBeatmapChanges()
{
try
{
// To handle the beatmap update flow, attempt to track selection changes across delete-insert transactions.
// When an update occurs, the previous beatmap set is either soft or hard deleted.
// Check if the current selection was potentially deleted by re-querying its validity.
bool selectedSetMarkedDeleted = SelectedBeatmapSet != null && fetchFromID(SelectedBeatmapSet.ID)?.DeletePending != false;

foreach (var set in setsRequiringRemoval) removeBeatmapSet(set.ID);

foreach (var set in setsRequiringUpdate) updateBeatmapSet(set);
Expand All @@ -331,11 +336,6 @@ private void processBeatmapChanges()
// If SelectedBeatmapInfo is non-null, the set should also be non-null.
Debug.Assert(SelectedBeatmapSet != null);

// To handle the beatmap update flow, attempt to track selection changes across delete-insert transactions.
// When an update occurs, the previous beatmap set is either soft or hard deleted.
// Check if the current selection was potentially deleted by re-querying its validity.
bool selectedSetMarkedDeleted = fetchFromID(SelectedBeatmapSet.ID)?.DeletePending != false;

if (selectedSetMarkedDeleted && setsRequiringUpdate.Any())
{
// If it is no longer valid, make the bold assumption that an updated version will be available in the modified/inserted indices.
Expand Down

0 comments on commit 7b3376c

Please sign in to comment.