Fix cancellation token source recreated on every medal

This commit is contained in:
Salman Ahmed
2022-03-04 10:00:56 +03:00
parent 3a37e6e8b1
commit 76c293b9e9

View File

@ -68,10 +68,12 @@ namespace osu.Game.Overlays.Profile.Header
private void updateDisplay(APIUser user) private void updateDisplay(APIUser user)
{ {
var badges = user.Badges; cancellationTokenSource?.Cancel();
cancellationTokenSource = new CancellationTokenSource();
badgeFlowContainer.Clear(); badgeFlowContainer.Clear();
cancellationTokenSource?.Cancel(); var badges = user.Badges;
if (badges?.Length > 0) if (badges?.Length > 0)
{ {
@ -84,7 +86,7 @@ namespace osu.Game.Overlays.Profile.Header
{ {
// load in stable order regardless of async load order. // load in stable order regardless of async load order.
badgeFlowContainer.Insert(displayIndex, asyncBadge); badgeFlowContainer.Insert(displayIndex, asyncBadge);
}, (cancellationTokenSource = new CancellationTokenSource()).Token); }, cancellationTokenSource.Token);
} }
} }
else else