From 2ff01abffa56f02c705a0bbfaa8d6429b3a242ca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Mon, 28 Jul 2025 11:04:54 +0200 Subject: [PATCH] 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 --- .../SelectV2/BeatmapTitleWedge_FavouriteButton.cs | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/osu.Game/Screens/SelectV2/BeatmapTitleWedge_FavouriteButton.cs b/osu.Game/Screens/SelectV2/BeatmapTitleWedge_FavouriteButton.cs index ae44442876..a3087d3c30 100644 --- a/osu.Game/Screens/SelectV2/BeatmapTitleWedge_FavouriteButton.cs +++ b/osu.Game/Screens/SelectV2/BeatmapTitleWedge_FavouriteButton.cs @@ -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(); }