fix: index not being assigned proper value #420
This commit is contained in:
2 files changed
+9
-28
No files matched your search
@@ -145,15 +145,10 @@ const PlayButton = ({
|
|||||||
seasonId: item.SeasonId,
|
seasonId: item.SeasonId,
|
||||||
// startItemId: item.Id,
|
// startItemId: item.Id,
|
||||||
});
|
});
|
||||||
if (
|
if (result.data.Items?.map((i) => i.Id).indexOf(currentEpisodeId) === -1) {
|
||||||
result.data.Items?.map((i) => i.Id).indexOf(currentEpisodeId) &&
|
throw new Error("Episode not found, index return -1");
|
||||||
result.data.Items?.map((i) => i.Id).indexOf(currentEpisodeId) >
|
|
||||||
-1
|
|
||||||
) {
|
|
||||||
index = result.data.Items?.map((i) => i.Id).indexOf(
|
|
||||||
currentEpisodeId,
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
index = result.data.Items?.map((i) => i.Id).indexOf(currentEpisodeId) ?? 0;
|
||||||
mediaSource = await getMediaInfoApi(api).getPostedPlaybackInfo({
|
mediaSource = await getMediaInfoApi(api).getPostedPlaybackInfo({
|
||||||
audioStreamIndex: currentAudioTrack,
|
audioStreamIndex: currentAudioTrack,
|
||||||
subtitleStreamIndex:
|
subtitleStreamIndex:
|
||||||
@@ -188,14 +183,10 @@ const PlayButton = ({
|
|||||||
enableUserData: true,
|
enableUserData: true,
|
||||||
userId: userId,
|
userId: userId,
|
||||||
});
|
});
|
||||||
if (
|
if (result.data.Items?.map((i) => i.Id).indexOf(currentEpisodeId) === -1) {
|
||||||
result.data.Items?.map((i) => i.Id).indexOf(currentEpisodeId) &&
|
throw new Error("Episode not found, index return -1");
|
||||||
result.data.Items?.map((i) => i.Id).indexOf(currentEpisodeId) > -1
|
|
||||||
) {
|
|
||||||
index = result.data.Items?.map((i) => i.Id).indexOf(
|
|
||||||
currentEpisodeId,
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
index = result.data.Items?.map((i) => i.Id).indexOf(currentEpisodeId) ?? 0;
|
||||||
if (
|
if (
|
||||||
result.data.Items?.[index]?.Id &&
|
result.data.Items?.[index]?.Id &&
|
||||||
result.data.Items?.[index].MediaSources?.[0]?.Id
|
result.data.Items?.[index].MediaSources?.[0]?.Id
|
||||||
@@ -451,7 +442,7 @@ const PlayButton = ({
|
|||||||
color="primary"
|
color="primary"
|
||||||
aria-label="Play"
|
aria-label="Play"
|
||||||
className={className}
|
className={className}
|
||||||
onClick={handleClick}
|
onClick={(e) => handleClick(e, item.Id)}
|
||||||
sx={sx}
|
sx={sx}
|
||||||
size={size}
|
size={size}
|
||||||
{...buttonProps}
|
{...buttonProps}
|
||||||
|
|||||||
@@ -1115,24 +1115,14 @@ function SeriesTitlePage() {
|
|||||||
itemId={episode.Id}
|
itemId={episode.Id}
|
||||||
itemName={episode.Name}
|
itemName={episode.Name}
|
||||||
isFavorite={episode.UserData?.IsFavorite}
|
isFavorite={episode.UserData?.IsFavorite}
|
||||||
queryKey={[
|
queryKey={["item", id]}
|
||||||
"item",
|
|
||||||
id,
|
|
||||||
`season ${currentSeason + 1}`,
|
|
||||||
"episodes",
|
|
||||||
]}
|
|
||||||
userId={user?.Id}
|
userId={user?.Id}
|
||||||
/>
|
/>
|
||||||
<MarkPlayedButton
|
<MarkPlayedButton
|
||||||
itemId={episode.Id}
|
itemId={episode.Id}
|
||||||
itemName={episode.Name}
|
itemName={episode.Name}
|
||||||
isPlayed={episode.UserData?.Played}
|
isPlayed={episode.UserData?.Played}
|
||||||
queryKey={[
|
queryKey={["item", id]}
|
||||||
"item",
|
|
||||||
id,
|
|
||||||
`season ${currentSeason + 1}`,
|
|
||||||
"episodes",
|
|
||||||
]}
|
|
||||||
userId={user?.Id}
|
userId={user?.Id}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in new issue
Block a user