diff --git a/src/components/AnimeDetails.js b/src/components/AnimeDetails.js index 04141a9..e1ca730 100644 --- a/src/components/AnimeDetails.js +++ b/src/components/AnimeDetails.js @@ -15,6 +15,14 @@ export default function AnimeDetails({ anime }) { console.log('AnimeDetails received:', anime); + // Check if synopsis overflows when component mounts or when content changes + useEffect(() => { + if (synopsisRef.current) { + const element = synopsisRef.current; + setSynopsisOverflows(element.scrollHeight > element.clientHeight); + } + }, [anime?.info?.description, activeTab]); + if (!anime?.info) { console.error('Invalid anime data structure:', anime); return null; @@ -24,14 +32,6 @@ export default function AnimeDetails({ anime }) { const hasCharacters = info.characterVoiceActor?.length > 0 || info.charactersVoiceActors?.length > 0; const hasVideos = info.promotionalVideos && info.promotionalVideos.length > 0; - // Check if synopsis overflows when component mounts or when content changes - useEffect(() => { - if (synopsisRef.current) { - const element = synopsisRef.current; - setSynopsisOverflows(element.scrollHeight > element.clientHeight); - } - }, [info.description, activeTab]); - // Video modal for promotional videos const VideoModal = ({ video, onClose }) => { if (!video) return null;