Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: filter out null entries in episode list #600

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

2547techno
Copy link

closes #568

The Issue

episodeList can appear in the form:

[null, null, {...}, ...]

This happens when the anilist api does not return the full list of episodes for an anime.

In the case of One Piece (#568), only ep. 1122 is returned from the api, leaving 1121 null's in the list before the first entry with actual episode data, resulting in the following error:

EpisodeList.svelte:14
Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'episode')
    at get_each_context (EpisodeList.svelte:14:65)
    at Object.update [as p] (EpisodeList.svelte:61:7)
    at update (scheduler.js:119:1)
    at flush (scheduler.js:79:1)

due to the destructuring of list entries here:

{#each episodeOrder ? episodeList : [...episodeList].reverse() as { episode, image, summary, rating, title, length, airdate, filler }}

list can appear in the form:
```
[null, null {...}]
```
when anilist api does not return `episodeCount` number of episodes.

In the case of One Piece (ThaUnknown#568), only ep. 1122 is returned from the api,
leaving 1121 null's in the list before the first entry with actual
episode data
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug]: One Piece doesn't load and breaks app
1 participant