diff --git a/lib/caching.ts b/lib/caching.ts index 293c054..3ee20e1 100644 --- a/lib/caching.ts +++ b/lib/caching.ts @@ -23,7 +23,7 @@ type UpdatedSeries = { lastFetch: Date; episodes: Episode[]; } & Series; -async function updateFetch(existingSeries: Series): Promise { +async function updateFetch(existingSeries: Series): Promise { const series = await nrkRadio.getSeries(existingSeries.id); if (!series) { return null; @@ -32,6 +32,10 @@ async function updateFetch(existingSeries: Series): Promise serieEpisode.id === episode.id); }); + if (newEpisodes.length === 0) { + return existingSeries; + } + /** * Since we don't control the API, * we should not make assumptions about the order,