Fix infinite scroll on the poster list
This commit is contained in:
parent
817da07a2d
commit
56dbd65730
@ -98,6 +98,7 @@ const Posters = ({
|
||||
const [size, setSize] = useState(0);
|
||||
const [postersPerRow, setPostersPerRow] = useState(0);
|
||||
const [posterHeight, setPosterHeight] = useState(0);
|
||||
const [initialLoading, setInitialLoading] = useState(true);
|
||||
|
||||
const loadMore = useCallback(() => {
|
||||
if (size === elmts.size) {
|
||||
@ -111,8 +112,11 @@ const Posters = ({
|
||||
}, [size, elmts.size]);
|
||||
|
||||
useEffect(() => {
|
||||
loadMore();
|
||||
}, [elmts.size, loadMore]);
|
||||
if (initialLoading) {
|
||||
loadMore();
|
||||
setInitialLoading(false);
|
||||
}
|
||||
}, [loadMore, initialLoading, setInitialLoading]);
|
||||
|
||||
const move = useCallback(
|
||||
(event) => {
|
||||
|
Loading…
x
Reference in New Issue
Block a user