From f7626aba1821f5f346dfa36a06438836bbc819ea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Tue, 23 Apr 2024 13:36:12 +0200 Subject: [PATCH] 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. --- osu.Game/Overlays/Mods/ModColumn.cs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/osu.Game/Overlays/Mods/ModColumn.cs b/osu.Game/Overlays/Mods/ModColumn.cs index df33c78ea4..e9f21338bd 100644 --- a/osu.Game/Overlays/Mods/ModColumn.cs +++ b/osu.Game/Overlays/Mods/ModColumn.cs @@ -69,6 +69,7 @@ namespace osu.Game.Overlays.Mods private Task? latestLoadTask; private ModPanel[]? latestLoadedPanels; internal bool ItemsLoaded => latestLoadTask?.IsCompleted == true && allPanelsLoaded; + private bool? wasPresent; private bool allPanelsLoaded { @@ -192,6 +193,15 @@ namespace osu.Game.Overlays.Mods { 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))