fix: 'upcoming season' popular titles not returning

This commit is contained in:
2025-12-07 08:19:58 -05:00
parent 6e3e3431c9
commit 67e07331a1
2 changed files with 6 additions and 18 deletions

View File

@@ -31,22 +31,13 @@ export async function fetchPopularTitlesFromAnilist(
mapTitle(title),
);
if (!data.nextSeason?.media?.[0]?.nextAiringEpisode) {
return {
trending: trendingTitles,
popular: popularSeasonTitles,
};
}
const nextSeasonData = await stub.nextSeasonPopular(
nextSeason,
nextYear,
limit,
const nextSeasonData = data.nextSeason?.media?.map((title: any) =>
mapTitle(title),
);
return {
trending: trendingTitles,
popular: popularSeasonTitles,
upcoming: nextSeasonData?.Page?.media?.map((title: any) => mapTitle(title)),
upcoming: nextSeasonData,
};
}

View File

@@ -225,18 +225,15 @@ export const BrowsePopularQuery = graphql(
...HomeTitle
}
}
nextSeason: Page(page: 1, perPage: 1) {
nextSeason: Page(page: 1, perPage: $limit) {
media(
season: $nextSeason
seasonYear: $nextYear
sort: START_DATE_DESC
sort: POPULARITY_DESC
type: ANIME
isAdult: false
) {
nextAiringEpisode {
airingAt
timeUntilAiring
}
...HomeTitle
}
}
}