1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-16 19:33:01 +08:00

Merge pull request #30385 from peppy/fix-selection-lost-during-update

Fix beatmap selection being lost during update process
This commit is contained in:
Dean Herbert 2024-10-22 19:24:01 +09:00 committed by GitHub
commit 7b3376ccd6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -322,6 +322,11 @@ namespace osu.Game.Screens.Select
{
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);
@ -331,11 +336,6 @@ namespace osu.Game.Screens.Select
// 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.