mirror of https://github.com/ppy/osu
Fix leaderboard potentially displaying the wrong scores
Closes #14762. This class is ugly. I think the whole process should be clened up once we have correctly-scheduled `SynchronizationContext`s. There's not much saving it as long as all these interdispersed `Schedule`s around required.
This commit is contained in:
parent
e6aa05a4a4
commit
3803f2f462
|
@ -255,6 +255,7 @@ private void load()
|
|||
}
|
||||
|
||||
private APIRequest getScoresRequest;
|
||||
private ScheduledDelegate getScoresRequestCallback;
|
||||
|
||||
protected abstract bool IsOnlineScope { get; }
|
||||
|
||||
|
@ -282,13 +283,16 @@ protected void UpdateScores()
|
|||
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 @@ protected void UpdateScores()
|
|||
if (getScoresRequest == null)
|
||||
return;
|
||||
|
||||
getScoresRequest.Failure += e => Schedule(() =>
|
||||
getScoresRequest.Failure += e => getScoresRequestCallback = Schedule(() =>
|
||||
{
|
||||
if (e is OperationCanceledException)
|
||||
return;
|
||||
|
|
Loading…
Reference in New Issue