Compare commits

...

2 Commits

Author SHA1 Message Date
2af6054091 Fix the last eslint warnings
All checks were successful
continuous-integration/drone/pr Build is passing
continuous-integration/drone/push Build is passing
2020-04-03 19:08:56 +02:00
56dbd65730 Fix infinite scroll on the poster list 2020-04-03 19:07:31 +02:00
3 changed files with 8 additions and 5 deletions

View File

@ -98,6 +98,7 @@ const Posters = ({
const [size, setSize] = useState(0); const [size, setSize] = useState(0);
const [postersPerRow, setPostersPerRow] = useState(0); const [postersPerRow, setPostersPerRow] = useState(0);
const [posterHeight, setPosterHeight] = useState(0); const [posterHeight, setPosterHeight] = useState(0);
const [initialLoading, setInitialLoading] = useState(true);
const loadMore = useCallback(() => { const loadMore = useCallback(() => {
if (size === elmts.size) { if (size === elmts.size) {
@ -111,8 +112,11 @@ const Posters = ({
}, [size, elmts.size]); }, [size, elmts.size]);
useEffect(() => { useEffect(() => {
loadMore(); if (initialLoading) {
}, [elmts.size, loadMore]); loadMore();
setInitialLoading(false);
}
}, [loadMore, initialLoading, setInitialLoading]);
const move = useCallback( const move = useCallback(
(event) => { (event) => {

View File

@ -1,5 +1,4 @@
import React, { useState } from "react"; import React, { useState } from "react";
import PropTypes from "prop-types";
import { useDispatch, useSelector } from "react-redux"; import { useDispatch, useSelector } from "react-redux";
import { Redirect, Link } from "react-router-dom"; import { Redirect, Link } from "react-router-dom";

View File

@ -60,8 +60,8 @@ const handlers = {
return state.mergeIn( return state.mergeIn(
["shows", action.payload.imdbId], ["shows", action.payload.imdbId],
Map({ Map({
tracked_season: season, tracked_season: season, // eslint-disable-line camelcase
tracked_episode: episode, tracked_episode: episode, // eslint-disable-line camelcase
}) })
); );
}, },