mirror of
https://github.com/p-stream/p-stream.git
synced 2026-04-19 18:12:10 +00:00
fix description expand not showing after changing seasons
This commit is contained in:
parent
c1421de03e
commit
13f51a899b
1 changed files with 19 additions and 1 deletions
|
|
@ -165,6 +165,12 @@ export function EpisodeCarousel({
|
|||
return element.scrollHeight > element.clientHeight;
|
||||
};
|
||||
|
||||
// Add a new effect to reset states when season changes
|
||||
useEffect(() => {
|
||||
setExpandedEpisodes({});
|
||||
setTruncatedEpisodes({});
|
||||
}, [selectedSeason]);
|
||||
|
||||
// Check truncation after render and when expanded state changes
|
||||
useEffect(() => {
|
||||
const checkTruncation = () => {
|
||||
|
|
@ -178,9 +184,21 @@ export function EpisodeCarousel({
|
|||
setTruncatedEpisodes(newTruncatedState);
|
||||
};
|
||||
|
||||
checkTruncation();
|
||||
|
||||
// Wait for the transition to complete
|
||||
const timeoutId = setTimeout(checkTruncation, 250);
|
||||
return () => clearTimeout(timeoutId);
|
||||
|
||||
// Also check when window is resized
|
||||
const handleResize = () => {
|
||||
checkTruncation();
|
||||
};
|
||||
window.addEventListener("resize", handleResize);
|
||||
|
||||
return () => {
|
||||
clearTimeout(timeoutId);
|
||||
window.removeEventListener("resize", handleResize);
|
||||
};
|
||||
}, [episodes, expandedEpisodes]);
|
||||
|
||||
return (
|
||||
|
|
|
|||
Loading…
Reference in a new issue