Fix mod select overlay columns not displaying properly sometimes

Closes https://github.com/ppy/osu/issues/26504.

As far as I can tell the issue is basically another manifestation of
https://github.com/ppy/osu-framework/issues/5129, i.e. presence
overrides causing dropped invalidations and thus completely bogus
hierarchy state. The fix is to raise the appropriate invalidation
manually.
This commit is contained in:
Bartłomiej Dach 2024-04-23 13:36:12 +02:00
parent 12acdeebf1
commit f7626aba18
No known key found for this signature in database
1 changed files with 10 additions and 0 deletions

View File

@ -69,6 +69,7 @@ public IReadOnlyList<ModState> AvailableMods
private Task? latestLoadTask;
private ModPanel[]? latestLoadedPanels;
internal bool ItemsLoaded => latestLoadTask?.IsCompleted == true && allPanelsLoaded;
private bool? wasPresent;
private bool allPanelsLoaded
{
@ -192,6 +193,15 @@ protected override void Update()
{
base.Update();
// we override `IsPresent` to include the scheduler's pending task state to make async loads work correctly when columns are masked away
// (see description of https://github.com/ppy/osu/pull/19783).
// however, because of that we must also ensure that we signal correct invalidations (https://github.com/ppy/osu-framework/issues/5129).
// failing to do so causes columns to be stuck in "present" mode despite actually not being present themselves.
// this works because `Update()` will always run after a scheduler update, which is what causes the presence state change responsible for the failure.
if (wasPresent != null && wasPresent != IsPresent)
Invalidate(Invalidation.Presence);
wasPresent = IsPresent;
if (selectionDelay == initial_multiple_selection_delay || Time.Current - lastSelection >= selectionDelay)
{
if (pendingSelectionOperations.TryDequeue(out var dequeuedAction))