1
0
mirror of https://github.com/ppy/osu.git synced 2024-09-22 06:47:24 +08:00

Fix DirectOverlay performing webrequests on startup

This commit is contained in:
smoogipoo 2018-08-29 15:56:24 +09:00
parent df18508bd6
commit 327bc708d7

View File

@ -240,6 +240,15 @@ namespace osu.Game.Overlays
}); });
} }
protected override void PopIn()
{
base.PopIn();
// Queries are allowed to be run only on the first pop-in
if (getSetsRequest == null)
Scheduler.AddOnce(updateSearch);
}
private SearchBeatmapSetsRequest getSetsRequest; private SearchBeatmapSetsRequest getSetsRequest;
private readonly Bindable<string> currentQuery = new Bindable<string>(); private readonly Bindable<string> currentQuery = new Bindable<string>();
@ -251,16 +260,22 @@ namespace osu.Game.Overlays
{ {
queryChangedDebounce?.Cancel(); queryChangedDebounce?.Cancel();
if (!IsLoaded) return; if (!IsLoaded)
return;
if (State == Visibility.Hidden)
return;
BeatmapSets = null; BeatmapSets = null;
ResultAmounts = null; ResultAmounts = null;
getSetsRequest?.Cancel(); getSetsRequest?.Cancel();
if (api == null) return; if (api == null)
return;
if (Header.Tabs.Current.Value == DirectTab.Search && (Filter.Search.Text == string.Empty || currentQuery == string.Empty)) return; if (Header.Tabs.Current.Value == DirectTab.Search && (Filter.Search.Text == string.Empty || currentQuery == string.Empty))
return;
previewTrackManager.StopAnyPlaying(this); previewTrackManager.StopAnyPlaying(this);