From b0f07dd0a4535a330553e323417ccdd354fae22f Mon Sep 17 00:00:00 2001 From: Paul Buetow Date: Fri, 22 May 2026 09:52:26 +0300 Subject: Fix bb review issues: stale snapshot, double-tap guard, button dedup, comments - _downloadEpisodeAt: read _episodes fresh inside setState instead of using the pre-await snapshot, and guard that the index is still valid and the row still lacks a mediaId, preventing silent overwrites of data refreshed by _load() during the await. - Add Set _pendingDownloads to prevent concurrent download API calls when the user double-taps; visually disable the button while in-flight via new isLoading parameter on _DownloadButton. - Extract _EpisodeActionButton shared primitive to eliminate structural duplication between _PlayButton and _DownloadButton (DRY). - Fix misleading mediaId null-safety comment to describe the actual guarantee. - Add comments to episodeToggleErrorMessage and episodeDownloadErrorMessage explaining why they use action-specific fallback strings. Co-Authored-By: Claude Sonnet 4.6 --- player-android/lib/utils/error_mappers.dart | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'player-android/lib/utils') diff --git a/player-android/lib/utils/error_mappers.dart b/player-android/lib/utils/error_mappers.dart index 4427efa..b7c0fe3 100644 --- a/player-android/lib/utils/error_mappers.dart +++ b/player-android/lib/utils/error_mappers.dart @@ -318,6 +318,9 @@ String episodeToggleErrorMessage(Object error) { } return dioConnectionErrorMessage(error); } + // Action-specific fallback: gives the user more context than a generic + // "Unexpected error" message when the toggle mutation fails for an unknown + // reason (e.g. an exception type that is not a DioException). return 'Could not update episode. Please try again.'; } @@ -345,5 +348,8 @@ String episodeDownloadErrorMessage(Object error) { } return dioConnectionErrorMessage(error); } + // Action-specific fallback: gives the user more context than a generic + // "Unexpected error" message when the download mutation fails for an unknown + // reason (e.g. an exception type that is not a DioException). return 'Could not download episode. Please try again.'; } -- cgit v1.2.3