mirror of
https://github.com/Stremio/stremio-web.git
synced 2026-03-11 21:27:05 +00:00
Fix infinite scroll issue on large screens
This commit is contained in:
parent
45f8afea91
commit
12c75d2d11
1 changed files with 9 additions and 0 deletions
|
|
@ -26,6 +26,15 @@ const Discover = ({ urlParams, queryParams }) => {
|
|||
metasContainerRef.current.scrollTop = 0;
|
||||
}
|
||||
}, [discover.catalog]);
|
||||
React.useEffect(() => {
|
||||
if (hasNextPage && metasContainerRef.current) {
|
||||
const containerHeight = metasContainerRef.current.scrollHeight;
|
||||
const viewportHeight = metasContainerRef.current.clientHeight;
|
||||
if (containerHeight <= viewportHeight) {
|
||||
loadNextPage();
|
||||
}
|
||||
}
|
||||
}, [hasNextPage, loadNextPage]);
|
||||
const selectedMetaItem = React.useMemo(() => {
|
||||
return discover.catalog !== null &&
|
||||
discover.catalog.content.type === 'Ready' &&
|
||||
|
|
|
|||
Loading…
Reference in a new issue