From 120e283e3dd23ab40c914e479ad395641897b438 Mon Sep 17 00:00:00 2001 From: Prayag Prajapati Date: Wed, 12 Nov 2025 00:37:20 +0530 Subject: [PATCH] fix: item pages not renderinf --- src/components/itemBackdrop/index.tsx | 120 +++++++++++++++++++ src/routes/_api/album/$id.tsx | 52 ++++---- src/routes/_api/artist/$id.tsx | 50 ++++---- src/routes/_api/boxset/$id.tsx | 51 ++++---- src/routes/_api/episode/$id.tsx | 106 +++++++--------- src/routes/_api/item/$id.tsx | 66 ++++------ src/routes/_api/series/$id.tsx | 166 ++++++++++++-------------- 7 files changed, 330 insertions(+), 281 deletions(-) create mode 100644 src/components/itemBackdrop/index.tsx diff --git a/src/components/itemBackdrop/index.tsx b/src/components/itemBackdrop/index.tsx new file mode 100644 index 0000000..5e8b3c8 --- /dev/null +++ b/src/components/itemBackdrop/index.tsx @@ -0,0 +1,120 @@ +import { + type HTMLMotionProps, + motion, + useScroll, + useTransform, +} from "motion/react"; +import React, { type RefObject, useEffect, useState } from "react"; + +interface ItemBackdropProps { + targetRef: RefObject; + backdropSrc?: string; + fallbackSrc: string; + alt: string; + distance?: number; // parallax distance + className?: string; + onLoad?: (e: React.SyntheticEvent) => void; + motionProps?: HTMLMotionProps<"img">; +} + +/** + * ItemBackdrop delays applying motion-driven parallax until after mount + * to avoid hydration timing errors ("Target ref is defined but not hydrated"). + * It accepts a scroll container ref from the parent; if the ref is not yet + * attached, it renders a static img to prevent motion from touching an + * unhydrated DOM node. + */ +function ItemBackdropContent({ + targetRef, + src, + alt, + distance, + className, + onLoad, + motionProps, +}: { + targetRef: RefObject; + src: string; + alt: string; + distance: number; + className?: string; + onLoad?: (e: React.SyntheticEvent) => void; + motionProps?: HTMLMotionProps<"img">; +}) { + const { scrollYProgress } = useScroll({ + target: targetRef, + offset: ["start start", "60vh start"], + }); + const y = useTransform(scrollYProgress, [0, 1], [-distance, distance]); + return ( + { + e.currentTarget.style.opacity = "1"; + onLoad?.(e); + }} + style={{ y }} + {...motionProps} + /> + ); +} + +export function ItemBackdrop({ + targetRef, + backdropSrc, + fallbackSrc, + alt, + distance = 50, + className, + onLoad, + motionProps, +}: ItemBackdropProps) { + const src = backdropSrc || fallbackSrc; + const [ready, setReady] = useState(false); + // Poll a few animation frames until the target ref hydrates to avoid premature motion initialization. + useEffect(() => { + if (ready) return; + let frame = 0; + let raf: number; + const tick = () => { + if (targetRef.current || frame > 5) { + setReady(true); + return; + } + frame++; + raf = requestAnimationFrame(tick); + }; + tick(); + return () => cancelAnimationFrame(raf); + }, [targetRef, ready]); + + if (!ready) { + return ( + {alt} { + e.currentTarget.style.opacity = "1"; + onLoad?.(e); + }} + /> + ); + } + + return ( + + ); +} + +export default ItemBackdrop; diff --git a/src/routes/_api/album/$id.tsx b/src/routes/_api/album/$id.tsx index 5bba028..d5ed6ba 100644 --- a/src/routes/_api/album/$id.tsx +++ b/src/routes/_api/album/$id.tsx @@ -1,39 +1,31 @@ -import React, { useLayoutEffect, useMemo } from "react"; - -import Box from "@mui/material/Box"; -import CircularProgress from "@mui/material/CircularProgress"; -import Typography from "@mui/material/Typography"; - import { BaseItemKind, SortOrder } from "@jellyfin/sdk/lib/generated-client"; import { getItemsApi } from "@jellyfin/sdk/lib/utils/api/items-api"; import { getLibraryApi } from "@jellyfin/sdk/lib/utils/api/library-api"; import { getUserLibraryApi } from "@jellyfin/sdk/lib/utils/api/user-library-api"; - - +import Box from "@mui/material/Box"; +import CircularProgress from "@mui/material/CircularProgress"; +import Typography from "@mui/material/Typography"; import { useQuery } from "@tanstack/react-query"; - -import { getRuntimeCompact } from "@/utils/date/time"; - -import { Card } from "@/components/card/card"; -import CardScroller from "@/components/cardScroller/cardScroller"; - +import React, { useLayoutEffect, useMemo } from "react"; import LikeButton from "@/components/buttons/likeButton"; import PlayButton from "@/components/buttons/playButton"; +import { Card } from "@/components/card/card"; +import CardScroller from "@/components/cardScroller/cardScroller"; import { ErrorNotice } from "@/components/notices/errorNotice/errorNotice"; - import { getTypeIcon } from "@/components/utils/iconsCollection"; +import { getRuntimeCompact } from "@/utils/date/time"; import { useBackdropStore } from "@/utils/store/backdrop"; import "./album.scss"; +import { Chip } from "@mui/material"; +import { createFileRoute, Link } from "@tanstack/react-router"; +import { createPortal } from "react-dom"; import AlbumMusicTrack from "@/components/albumMusicTrack"; import ShowMoreText from "@/components/showMoreText"; import TagChip from "@/components/tagChip"; import getImageUrlsApi from "@/utils/methods/getImageUrlsApi"; import { useApiInContext } from "@/utils/store/api"; import { useCentralStore } from "@/utils/store/central"; -import { Chip } from "@mui/material"; -import { Link, createFileRoute } from "@tanstack/react-router"; -import { createPortal } from "react-dom"; export const Route = createFileRoute("/_api/album/$id")({ component: MusicAlbumTitlePage, @@ -95,7 +87,8 @@ function MusicAlbumTitlePage() { networkMode: "always", }); - const [setAppBackdrop] = useBackdropStore((state) => [state.setBackdrop]); + const setBackdrop = useBackdropStore((state) => state.setBackdrop); + const lastBackdropRef = React.useRef(undefined); const allDiscs = useMemo(() => { const discs: number[] = []; @@ -111,15 +104,22 @@ function MusicAlbumTitlePage() { } return discs; }, [musicTracks.data]); - + useLayoutEffect(() => { - if (item.isSuccess) { - setAppBackdrop( - `${api?.basePath}/Items/${item.data?.ParentBackdropItemId}/Images/Backdrop`, - item.data?.Id, - ); + if (item.isSuccess && item.data) { + const backdropItemId = item.data.ParentBackdropItemId; + if (backdropItemId && lastBackdropRef.current !== backdropItemId) { + const hash = + item.data.ImageBlurHashes?.Backdrop?.[ + item.data.ParentBackdropImageTags?.[0] ?? "" + ]; + if (hash) { + setBackdrop(hash); + lastBackdropRef.current = backdropItemId; + } + } } - }, [item.isSuccess]); + }, [item.isSuccess, item.data, setBackdrop]); if (item.isPending || similarItems.isPending) { return ( diff --git a/src/routes/_api/artist/$id.tsx b/src/routes/_api/artist/$id.tsx index 764d073..df545a7 100644 --- a/src/routes/_api/artist/$id.tsx +++ b/src/routes/_api/artist/$id.tsx @@ -1,21 +1,3 @@ -import React, { - useState, - useEffect, - useLayoutEffect, - useRef, - type ReactNode, -} from "react"; - -import Box from "@mui/material/Box"; -import CircularProgress from "@mui/material/CircularProgress"; -import Divider from "@mui/material/Divider"; -import Tab from "@mui/material/Tab"; -import Tabs from "@mui/material/Tabs"; -import Typography from "@mui/material/Typography"; - -import useParallax from "@/utils/hooks/useParallax"; -import { AnimatePresence, motion, useScroll } from "motion/react"; - import { BaseItemKind, ItemFields, @@ -23,25 +5,38 @@ import { } from "@jellyfin/sdk/lib/generated-client"; import { getItemsApi } from "@jellyfin/sdk/lib/utils/api/items-api"; import { getUserLibraryApi } from "@jellyfin/sdk/lib/utils/api/user-library-api"; - +import Box from "@mui/material/Box"; +import CircularProgress from "@mui/material/CircularProgress"; +import Divider from "@mui/material/Divider"; +import Tab from "@mui/material/Tab"; +import Tabs from "@mui/material/Tabs"; +import Typography from "@mui/material/Typography"; import { useQuery } from "@tanstack/react-query"; +import { AnimatePresence, motion, useScroll } from "motion/react"; +import React, { + type ReactNode, + useEffect, + useLayoutEffect, + useRef, + useState, +} from "react"; +import { Blurhash } from "react-blurhash"; import LikeButton from "@/components/buttons/likeButton"; import { Card } from "@/components/card/card"; -import { Blurhash } from "react-blurhash"; - import { ArtistAlbum } from "@/components/layouts/artist/artistAlbum"; import MusicTrack from "@/components/musicTrack"; import { ErrorNotice } from "@/components/notices/errorNotice/errorNotice"; import ShowMoreText from "@/components/showMoreText"; +import useParallax from "@/utils/hooks/useParallax"; import { useBackdropStore } from "@/utils/store/backdrop"; import "./artist.scss"; +import { createFileRoute } from "@tanstack/react-router"; import IconLink from "@/components/iconLink"; import { getTypeIcon } from "@/components/utils/iconsCollection"; import getImageUrlsApi from "@/utils/methods/getImageUrlsApi"; import { useCentralStore } from "@/utils/store/central"; -import { createFileRoute } from "@tanstack/react-router"; type TabPanelProp = { @@ -182,16 +177,13 @@ function ArtistTitlePage() { const { setBackdrop } = useBackdropStore(); useEffect(() => { if (item.isSuccess && item.data) { - setBackdrop( - `${api?.basePath}/Items/${item.data.Id}/Images/Backdrop`, - item.data.Id, - ); + setBackdrop(`${api?.basePath}/Items/${item.data.Id}/Images/Backdrop`); } }, [item.isSuccess]); - const pageRef = useRef(null); + const scrollTargetRef = useRef(null); const { scrollYProgress } = useScroll({ - target: pageRef, + target: scrollTargetRef, offset: ["start start", "60vh start"], }); const parallax = useParallax(scrollYProgress, 50); @@ -226,8 +218,8 @@ function ArtistTitlePage() { ease: "easeInOut", }} className="scrollY item item-artist" - ref={pageRef} > +
(null); const { scrollYProgress } = useScroll({ - target: pageRef, + target: scrollTargetRef, offset: ["start start", "60vh start"], - layoutEffect: false, }); const parallax = useParallax(scrollYProgress, 50); @@ -159,8 +150,8 @@ function BoxSetTitlePage() { ease: "easeInOut", }} className="scrollY item item-boxset padded-top" - ref={pageRef} > +
{item.data.BackdropImageTags?.length ? ( diff --git a/src/routes/_api/episode/$id.tsx b/src/routes/_api/episode/$id.tsx index 383673a..eb0211d 100644 --- a/src/routes/_api/episode/$id.tsx +++ b/src/routes/_api/episode/$id.tsx @@ -1,33 +1,27 @@ -import React, { useState, useRef, useMemo, useEffect } from "react"; - -import Box from "@mui/material/Box"; -import Chip from "@mui/material/Chip"; -import CircularProgress from "@mui/material/CircularProgress"; -import MenuItem from "@mui/material/MenuItem"; -import Stack from "@mui/material/Stack"; -import TextField from "@mui/material/TextField"; -import Typography from "@mui/material/Typography"; -import { green, red, yellow } from "@mui/material/colors"; - -import { Blurhash } from "react-blurhash"; - -import useParallax from "@/utils/hooks/useParallax"; -import { motion, useScroll } from "motion/react"; - import { BaseItemKind, MediaStreamType, } from "@jellyfin/sdk/lib/generated-client"; import { getUserLibraryApi } from "@jellyfin/sdk/lib/utils/api/user-library-api"; - +import Box from "@mui/material/Box"; +import Chip from "@mui/material/Chip"; +import CircularProgress from "@mui/material/CircularProgress"; +import { green, red, yellow } from "@mui/material/colors"; +import MenuItem from "@mui/material/MenuItem"; +import Stack from "@mui/material/Stack"; +import TextField from "@mui/material/TextField"; +import Typography from "@mui/material/Typography"; import { useQuery } from "@tanstack/react-query"; - +import { motion } from "motion/react"; +import React, { useEffect, useMemo, useRef, useState } from "react"; +import { Blurhash } from "react-blurhash"; import heroBg from "@/assets/herobg.png"; - import LikeButton from "@/components/buttons/likeButton"; import MarkPlayedButton from "@/components/buttons/markPlayedButton"; import PlayButton from "@/components/buttons/playButton"; import TrailerButton from "@/components/buttons/trailerButton"; +// import useParallax from "@/utils/hooks/useParallax"; +import ItemBackdrop from "@/components/itemBackdrop"; import { ErrorNotice } from "@/components/notices/errorNotice/errorNotice"; import ShowMoreText from "@/components/showMoreText"; import { getTypeIcon } from "@/components/utils/iconsCollection"; @@ -35,32 +29,30 @@ import { endsAt, getRuntime } from "@/utils/date/time"; import { useBackdropStore } from "@/utils/store/backdrop"; import "./episode.scss"; +import { getItemsApi } from "@jellyfin/sdk/lib/utils/api/items-api"; +import { createFileRoute, Link } from "@tanstack/react-router"; import ultraHdIcon from "@/assets/icons/4k.svg"; import dolbyAtmosIcon from "@/assets/icons/dolby-atmos.svg"; -import dolbyDigitalPlusIcon from "@/assets/icons/dolby-digital-plus.svg"; import dolbyDigitalIcon from "@/assets/icons/dolby-digital.svg"; +import dolbyDigitalPlusIcon from "@/assets/icons/dolby-digital-plus.svg"; import dolbyTrueHDIcon from "@/assets/icons/dolby-truehd.svg"; -import dolbyVisionAtmosIcon from "@/assets/icons/dolby-vision-atmos.png"; import dolbyVisionIcon from "@/assets/icons/dolby-vision.svg"; -import dtsHdMaIcon from "@/assets/icons/dts-hd-ma.svg"; +import dolbyVisionAtmosIcon from "@/assets/icons/dolby-vision-atmos.png"; import dtsIcon from "@/assets/icons/dts.svg"; +import dtsHdMaIcon from "@/assets/icons/dts-hd-ma.svg"; import hdIcon from "@/assets/icons/hd.svg"; import hdrIcon from "@/assets/icons/hdr.svg"; -import hdr10PlusIcon from "@/assets/icons/hdr10-plus.svg"; import hdr10Icon from "@/assets/icons/hdr10.svg"; +import hdr10PlusIcon from "@/assets/icons/hdr10-plus.svg"; import imaxIcon from "@/assets/icons/imax.svg"; import sdIcon from "@/assets/icons/sd.svg"; import sdrIcon from "@/assets/icons/sdr.svg"; - -import type MediaQualityInfo from "@/utils/types/mediaQualityInfo"; - import { Card } from "@/components/card/card"; import CardScroller from "@/components/cardScroller/cardScroller"; import IconLink from "@/components/iconLink"; import getImageUrlsApi from "@/utils/methods/getImageUrlsApi"; import { useCentralStore } from "@/utils/store/central"; -import { getItemsApi } from "@jellyfin/sdk/lib/utils/api/items-api"; -import { Link, createFileRoute } from "@tanstack/react-router"; +import type MediaQualityInfo from "@/utils/types/mediaQualityInfo"; export const Route = createFileRoute("/_api/episode/$id")({ component: EpisodeTitlePage, @@ -103,7 +95,7 @@ function EpisodeTitlePage() { networkMode: "always", }); - const [setAppBackdrop] = useBackdropStore((state) => [state.setBackdrop]); + const setBackdrop = useBackdropStore((state) => state.setBackdrop); const [selectedVideoTrack, setSelectedVideoTrack] = useState(0); const [selectedAudioTrack, setSelectedAudioTrack] = useState(0); @@ -157,7 +149,6 @@ function EpisodeTitlePage() { return item.data?.People?.filter((itm) => itm.Type === "Producer") ?? []; }, [item.data?.Id]); - const mediaQualityInfo = useMemo(() => { const checkAtmos = audioTracks.filter((audio) => audio.DisplayTitle?.toLocaleLowerCase().includes("atmos"), @@ -254,22 +245,20 @@ function EpisodeTitlePage() { }; }, [item.data?.Id]); + const lastBackdropRef = useRef(undefined); useEffect(() => { - if (api && item.isSuccess && item.data) { - setAppBackdrop( - `${api.basePath}/Items/${item.data.ParentBackdropItemId}/Images/Backdrop`, - item.data.Id, - ); - } - }, [item.isSuccess]); + if (!api || !item.isSuccess || !item.data) return; + const tag = item.data.ParentBackdropImageTags?.[0]; + // Prefer blurhash if available; fallback to URL + const hash = item.data.ImageBlurHashes?.Backdrop?.[tag ?? ""]; - const pageRef = useRef(null); - const { scrollYProgress } = useScroll({ - target: pageRef, - offset: ["start start", "60vh start"], - layoutEffect: false, - }); - const parallax = useParallax(scrollYProgress, 50); + if (hash && lastBackdropRef.current !== hash) { + lastBackdropRef.current = hash; + setBackdrop(hash); + } + }, [api, item.isSuccess, item.data, setBackdrop]); + + const containerRef = useRef(null); if (item.isPending) { return ( @@ -301,42 +290,31 @@ function EpisodeTitlePage() { ease: "easeInOut", }} className="scrollY padded-top flex flex-column item item-episode" - ref={pageRef} + ref={containerRef} >
{item.data.ParentBackdropImageTags?.length ? ( - { - e.currentTarget.style.opacity = "1"; - }} - style={{ - y: parallax, - }} /> ) : ( - { - e.currentTarget.style.opacity = "1"; - }} - style={{ - y: parallax, - }} /> )}
diff --git a/src/routes/_api/item/$id.tsx b/src/routes/_api/item/$id.tsx index 8e564b3..7535049 100644 --- a/src/routes/_api/item/$id.tsx +++ b/src/routes/_api/item/$id.tsx @@ -10,13 +10,14 @@ import Stack from "@mui/material/Stack"; import TextField from "@mui/material/TextField"; import Typography from "@mui/material/Typography"; import { useQuery, useSuspenseQuery } from "@tanstack/react-query"; -import { motion, useScroll } from "motion/react"; +import { motion } from "motion/react"; import React, { useLayoutEffect, useMemo, useRef, useState } from "react"; import { Blurhash } from "react-blurhash"; import heroBg from "@/assets/herobg.png"; import { Card } from "@/components/card/card"; import CardScroller from "@/components/cardScroller/cardScroller"; -import useParallax from "@/utils/hooks/useParallax"; +// import useParallax from "@/utils/hooks/useParallax"; +import ItemBackdrop from "@/components/itemBackdrop"; import "./item.scss"; @@ -43,7 +44,6 @@ import MarkPlayedButton from "@/components/buttons/markPlayedButton"; import PlayButton from "@/components/buttons/playButton"; import TrailerButton from "@/components/buttons/trailerButton"; import IconLink from "@/components/iconLink"; -import { ErrorNotice } from "@/components/notices/errorNotice/errorNotice"; import ShowMoreText from "@/components/showMoreText"; import ItemSkeleton from "@/components/skeleton/item"; import { getTypeIcon } from "@/components/utils/iconsCollection"; @@ -292,13 +292,8 @@ function ItemDetail() { } }, [item.data.Id]); - const pageRef = useRef(null); - const { scrollYProgress } = useScroll({ - layoutEffect: false, - target: pageRef, - offset: ["start start", "60vh start"], - }); - const parallax = useParallax(scrollYProgress, 50); + // Provide a scroll target ref to the backdrop component. + const scrollTargetRef = useRef(null); return (
- {item.data.BackdropImageTags?.length ? ( - { - e.currentTarget.style.opacity = "1"; - }} - style={{ - y: parallax, - }} - /> - ) : ( - { - e.currentTarget.style.opacity = "1"; - }} - style={{ - y: parallax, - }} - /> - )} +
{ const formatter = new Intl.DateTimeFormat(navigator.language ?? "en-US", { @@ -117,14 +108,19 @@ function SeriesTitlePage() { enabled: item.isSuccess, }); - const [backdropImage, setBackdropImage] = useState(() => { - const url = sessionStorage.getItem(`backdrop-${item.data?.Id}`); - const key = sessionStorage.getItem(`backdrop-${item.data?.Id}-key`); - return { url, key }; - }); + const [backdropImage, setBackdropImage] = useState( + () => { + const url = sessionStorage.getItem(`backdrop-${item.data?.Id}`); + const key = sessionStorage.getItem(`backdrop-${item.data?.Id}-key`); + return { url, key }; + }, + ); const [backdropImageLoaded, setBackdropImageLoaded] = useState(false); - const [currentSeason, setCurrentSeason] = useDefaultSeason(seasons, item.data?.Id); + const [currentSeason, setCurrentSeason] = useDefaultSeason( + seasons, + item.data?.Id, + ); const currentSeasonNumber = Number(currentSeason); @@ -187,6 +183,8 @@ function SeriesTitlePage() { return item.data?.People?.filter((itm) => itm.Type === "Producer") ?? []; }, [item.data?.Id]); + const lastBackdropHashRef = useRef(undefined); + useEffect(() => { if (api && currentSeasonItem.isSuccess && item.isSuccess) { if ( @@ -217,16 +215,17 @@ function SeriesTitlePage() { ), key: currentSeasonItem.data?.BackdropImageTags?.[0], }); - setBackdrop( - getImageUrlsApi(api).getItemImageUrlById( - currentSeasonItem.data?.Id ?? "", - "Backdrop", - { - tag: currentSeasonItem.data?.BackdropImageTags?.[0], - }, - ), - currentSeasonItem.data?.BackdropImageTags?.[0], - ); + const seasonBackdropTag = + currentSeasonItem.data?.BackdropImageTags?.[0]; + const seasonBackdropHash = + currentSeasonItem.data?.ImageBlurHashes?.Backdrop?.[ + seasonBackdropTag ?? "" + ] ?? ""; + + if (lastBackdropHashRef.current !== seasonBackdropHash) { + setBackdrop(seasonBackdropHash); + lastBackdropHashRef.current = seasonBackdropHash; + } setBackdropImageLoaded(false); } else if ( item.isSuccess && @@ -259,26 +258,28 @@ function SeriesTitlePage() { ), key: item.data?.BackdropImageTags?.[0], }); - setBackdrop( - getImageUrlsApi(api).getItemImageUrlById( - item.data?.Id ?? "", - "Backdrop", - { - tag: item.data?.BackdropImageTags?.[0], - }, - ), - item.data?.BackdropImageTags?.[0], - ); + const seriesBackdropTag = item.data?.BackdropImageTags?.[0]; + const seriesBackdropHash = + item.data?.ImageBlurHashes?.Backdrop?.[seriesBackdropTag ?? ""] ?? ""; + + if (lastBackdropHashRef.current !== seriesBackdropHash) { + setBackdrop(seriesBackdropHash); + lastBackdropHashRef.current = seriesBackdropHash; + } } } - }, [currentSeasonItem.dataUpdatedAt]); + }, [ + api, + currentSeasonItem.data, + currentSeasonItem.isSuccess, + item.data, + item.isSuccess, + setBackdrop, + backdropImage.key, + ]); - const pageRef = useRef(null); - const { scrollYProgress } = useScroll({ - target: pageRef, - offset: ["start start", "60vh start"], - }); - const parallax = useParallax(scrollYProgress, 50); + const containerRef = useRef(null); + // Parallax handled within ItemBackdrop to avoid hydration issues. const navigate = useNavigate(); @@ -313,48 +314,36 @@ function SeriesTitlePage() { ease: "easeInOut", }} className="scrollY padded-top flex flex-column item item-series" - ref={pageRef} + ref={containerRef} >
{item.data.BackdropImageTags ? ( - { console.info("Image Loaded"); setBackdropImageLoaded(true); }} - animate={{ - opacity: backdropImageLoaded ? 1 : 0, - }} - exit={{ - opacity: 0, - }} - transition={{ - duration: 0.2, - }} - style={{ - y: parallax, + motionProps={{ + initial: { opacity: 0 }, + animate: { opacity: backdropImageLoaded ? 1 : 0 }, + exit: { opacity: 0 }, + transition: { duration: 0.2 }, }} /> ) : ( - { - e.currentTarget.style.opacity = "1"; - }} - style={{ - y: parallax, - }} /> )} @@ -899,7 +888,10 @@ function SeriesTitlePage() { value={currentSeasonNumber} onChange={(e) => { const seasonIndex = Number(e.target.value); - if (!isNaN(seasonIndex) && isFinite(seasonIndex)) { + if ( + !Number.isNaN(seasonIndex) && + Number.isFinite(seasonIndex) + ) { setCurrentSeason(seasonIndex); sessionStorage.setItem( `season-${item.data?.Id}`, @@ -982,7 +974,7 @@ function SeriesTitlePage() { currentSubTrack="nosub" size="medium" buttonProps={{ - //@ts-ignore + //@ts-expect-error color: "white", style: { color: "black ",