mirror of
https://github.com/Radarr/Radarr.git
synced 2025-04-24 06:27:08 -04:00
Avoid fetching movies twice on initial load
This commit is contained in:
parent
6e68a91922
commit
74d2259f67
2 changed files with 10 additions and 3 deletions
|
@ -1,7 +1,6 @@
|
|||
import React, { useEffect } from 'react';
|
||||
import { useSelector } from 'react-redux';
|
||||
import { useParams } from 'react-router';
|
||||
import { useHistory } from 'react-router-dom';
|
||||
import { useHistory, useParams } from 'react-router';
|
||||
import NotFound from 'Components/NotFound';
|
||||
import usePrevious from 'Helpers/Hooks/usePrevious';
|
||||
import createAllMoviesSelector from 'Store/Selectors/createAllMoviesSelector';
|
||||
|
|
|
@ -6,6 +6,7 @@ import React, {
|
|||
useState,
|
||||
} from 'react';
|
||||
import { useDispatch, useSelector } from 'react-redux';
|
||||
import { useHistory } from 'react-router';
|
||||
import { SelectProvider } from 'App/SelectContext';
|
||||
import ClientSideCollectionAppState from 'App/State/ClientSideCollectionAppState';
|
||||
import MoviesAppState, { MovieIndexAppState } from 'App/State/MoviesAppState';
|
||||
|
@ -76,6 +77,8 @@ interface MovieIndexProps {
|
|||
}
|
||||
|
||||
const MovieIndex = withScrollPosition((props: MovieIndexProps) => {
|
||||
const history = useHistory();
|
||||
|
||||
const {
|
||||
isFetching,
|
||||
isPopulated,
|
||||
|
@ -107,7 +110,12 @@ const MovieIndex = withScrollPosition((props: MovieIndexProps) => {
|
|||
const [isSelectMode, setIsSelectMode] = useState(false);
|
||||
|
||||
useEffect(() => {
|
||||
dispatch(fetchMovies());
|
||||
if (history.action === 'PUSH') {
|
||||
dispatch(fetchMovies());
|
||||
}
|
||||
}, [history, dispatch]);
|
||||
|
||||
useEffect(() => {
|
||||
dispatch(fetchQueueDetails({ all: true }));
|
||||
}, [dispatch]);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue