fix: scroll to top of videos list on season change

This commit is contained in:
Botzy 2026-05-12 14:08:11 +03:00
parent 392a496617
commit d41f887766

View file

@ -71,11 +71,19 @@ const VideosList = ({ className, metaItem, libraryItem, season, seasonOnSelect,
return videosForSeason.every((video) => video.watched);
}, [videosForSeason]);
const videosContainerRef = React.useRef(null);
const [search, setSearch] = React.useState('');
const searchInputOnChange = React.useCallback((event) => {
setSearch(event.currentTarget.value);
}, []);
React.useEffect(() => {
if (videosContainerRef.current) {
videosContainerRef.current.scrollTo({ top: 0, behavior: 'smooth' });
}
}, [selectedSeason]);
const onMarkVideoAsWatched = (video, watched) => {
core.transport.dispatch({
action: 'MetaDetails',
@ -154,7 +162,7 @@ const VideosList = ({ className, metaItem, libraryItem, season, seasonOnSelect,
value={search}
onChange={searchInputOnChange}
/>
<div className={styles['videos-container']}>
<div ref={videosContainerRef} className={styles['videos-container']}>
{
videosForSeason
.filter((video) => {