From 3462bbbcb020e3a1f8502070f1e4d293a5fa89e4 Mon Sep 17 00:00:00 2001 From: WonderAliceUwU Date: Sun, 2 Aug 2026 12:49:10 +0200 Subject: [PATCH] fix: deleting seasons reflect when refreshing --- src/App.tsx | 40 +++++++++++++++++++++++++++++++++++++++- 1 file changed, 39 insertions(+), 1 deletion(-) diff --git a/src/App.tsx b/src/App.tsx index 2114fb4..7438b8d 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -1946,7 +1946,45 @@ function TitleDetailsModal(props: { seriesId: details.sonarrSeriesId, seasonNumber: activeSeasonNumber, }) - await refreshSeasonState(seasonValue || undefined) + setDetails((current) => current + ? { + ...current, + episodes: current.episodes.map((episode) => { + if (episode.seasonId !== seasonValue || episode.availability === 'unaired') { + return episode + } + + return { + ...episode, + availableInJellyfin: false, + availability: 'missing', + downloadStatus: 'idle', + downloadProgress: undefined, + canDownload: true, + canDelete: false, + } + }), + seasons: current.seasons.map((season) => season.id === seasonValue + ? { + ...season, + availableEpisodeCount: 0, + missingEpisodeCount: current.episodes.filter( + (episode) => episode.seasonId === seasonValue && episode.availability !== 'unaired' + ).length, + canDownload: true, + canDelete: false, + isDownloading: false, + downloadStatus: 'idle', + downloadProgress: undefined, + downloadLabel: undefined, + } + : season), + } + : current) + + window.setTimeout(() => { + void refreshSeasonState(seasonValue || undefined) + }, 2000) } catch (error) { setDetailsError(error instanceof Error ? error.message : 'Failed to delete season files.') } finally {