From b0d2d69d41c37bbacfa66ccfff9ee93fc82931ba Mon Sep 17 00:00:00 2001 From: Kentai Radiquum Date: Sat, 21 Sep 2024 02:00:55 +0500 Subject: [PATCH] fix: error if no episodes found in initial source --- app/components/ReleasePlayer/ReleasePlayer.tsx | 9 +++++++++ public/changelog/3.2.1.md | 1 + 2 files changed, 10 insertions(+) diff --git a/app/components/ReleasePlayer/ReleasePlayer.tsx b/app/components/ReleasePlayer/ReleasePlayer.tsx index 53bfa72..8abb669 100644 --- a/app/components/ReleasePlayer/ReleasePlayer.tsx +++ b/app/components/ReleasePlayer/ReleasePlayer.tsx @@ -64,6 +64,15 @@ export const ReleasePlayer = (props: { id: number }) => { async function _fetchInfo(url: string) { const episodes = await _fetch(url); + if (episodes.episodes.length === 0) { + + const remSources = sourcesInfo.filter((source) => source.id !== selectedSource.id); + setSourcesInfo(remSources); + setSelectedSource(remSources[0]); + + return; + } + setEpisodeInfo(episodes.episodes); setSelectedEpisode(episodes.episodes[0]); } diff --git a/public/changelog/3.2.1.md b/public/changelog/3.2.1.md index 234b368..5897a57 100644 --- a/public/changelog/3.2.1.md +++ b/public/changelog/3.2.1.md @@ -12,3 +12,4 @@ ## Исправлено - Исправлена горизонтальная прокрутка профиля на мобильных устройствах +- Исправлена ошибка если не найдено эпизодов в изначальном источнике