fix: 'upcoming season' popular titles not returning
This commit is contained in:
@@ -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,
|
||||
};
|
||||
}
|
||||
|
||||
@@ -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
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user