1
0
mirror of https://github.com/ppy/osu.git synced 2026-05-16 15:03:37 +08:00

Fix song select favourite button getting stuck spinning if operation failed

Closes https://github.com/ppy/osu/issues/34376

Compare handling with

    https://github.com/ppy/osu/blob/0b453772da964dddd2ee73f677367293b26dbf2a/osu.Game/Overlays/BeatmapSet/Buttons/FavouriteButton.cs#L81-L85
This commit is contained in:
Bartłomiej Dach
2025-07-28 11:04:54 +02:00
Unverified
parent 7407efeea5
commit 2ff01abffa
@@ -21,6 +21,7 @@ using osu.Game.Online.API;
using osu.Game.Online.API.Requests;
using osu.Game.Online.API.Requests.Responses;
using osu.Game.Overlays;
using osu.Game.Overlays.Notifications;
using osuTK;
using osuTK.Graphics;
@@ -50,6 +51,9 @@ namespace osu.Game.Screens.SelectV2
[Resolved]
private IAPIProvider api { get; set; } = null!;
[Resolved]
private INotificationOverlay? notifications { get; set; }
internal LocalisableString Text => valueText.Text;
public FavouriteButton()
@@ -224,6 +228,15 @@ namespace osu.Game.Screens.SelectV2
beatmapSet.FavouriteCount += hasFavourited ? 1 : -1;
setBeatmapSet(beatmapSet, withHeartAnimation: hasFavourited);
};
favouriteRequest.Failure += e =>
{
notifications?.Post(new SimpleNotification
{
Text = e.Message,
Icon = FontAwesome.Solid.Times,
});
setBeatmapSet(beatmapSet, withHeartAnimation: false);
};
api.Queue(favouriteRequest);
setLoading();
}