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

Merge pull request #14981 from peppy/fix-leaderboard-incorrect-load

Fix leaderboard potentially displaying the wrong scores
This commit is contained in:
Dan Balasescu 2021-10-06 16:40:26 +09:00 committed by GitHub
commit 0d1243a0b5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -255,6 +255,7 @@ namespace osu.Game.Online.Leaderboards
}
private APIRequest getScoresRequest;
private ScheduledDelegate getScoresRequestCallback;
protected abstract bool IsOnlineScope { get; }
@ -282,13 +283,16 @@ namespace osu.Game.Online.Leaderboards
getScoresRequest?.Cancel();
getScoresRequest = null;
getScoresRequestCallback?.Cancel();
getScoresRequestCallback = null;
pendingUpdateScores?.Cancel();
pendingUpdateScores = Schedule(() =>
{
PlaceholderState = PlaceholderState.Retrieving;
loading.Show();
getScoresRequest = FetchScores(scores => Schedule(() =>
getScoresRequest = FetchScores(scores => getScoresRequestCallback = Schedule(() =>
{
Scores = scores.ToArray();
PlaceholderState = Scores.Any() ? PlaceholderState.Successful : PlaceholderState.NoScores;
@ -297,7 +301,7 @@ namespace osu.Game.Online.Leaderboards
if (getScoresRequest == null)
return;
getScoresRequest.Failure += e => Schedule(() =>
getScoresRequest.Failure += e => getScoresRequestCallback = Schedule(() =>
{
if (e is OperationCanceledException)
return;