diff --git a/frontend/src/App/AppUpdatedModalContent.tsx b/frontend/src/App/AppUpdatedModalContent.tsx index d1d9ca965..7e5bd1e24 100644 --- a/frontend/src/App/AppUpdatedModalContent.tsx +++ b/frontend/src/App/AppUpdatedModalContent.tsx @@ -1,5 +1,5 @@ import React, { useCallback, useEffect } from 'react'; -import { useDispatch, useSelector } from 'react-redux'; +import { useSelector } from 'react-redux'; import Button from 'Components/Link/Button'; import LoadingIndicator from 'Components/Loading/LoadingIndicator'; import InlineMarkdown from 'Components/Markdown/InlineMarkdown'; @@ -9,7 +9,6 @@ import ModalFooter from 'Components/Modal/ModalFooter'; import ModalHeader from 'Components/Modal/ModalHeader'; import usePrevious from 'Helpers/Hooks/usePrevious'; import { kinds } from 'Helpers/Props'; -import { fetchUpdates } from 'Store/Actions/systemActions'; import UpdateChanges from 'System/Updates/UpdateChanges'; import useUpdates from 'System/Updates/useUpdates'; import Update from 'typings/Update'; @@ -64,9 +63,8 @@ interface AppUpdatedModalContentProps { } function AppUpdatedModalContent(props: AppUpdatedModalContentProps) { - const dispatch = useDispatch(); const { version, prevVersion } = useSelector((state: AppState) => state.app); - const { isFetched, error, data } = useUpdates(); + const { isFetched, error, data, refetch } = useUpdates(); const previousVersion = usePrevious(version); const { onModalClose } = props; @@ -77,15 +75,11 @@ function AppUpdatedModalContent(props: AppUpdatedModalContentProps) { window.location.href = `${window.Sonarr.urlBase}/system/updates`; }, []); - useEffect(() => { - dispatch(fetchUpdates()); - }, [dispatch]); - useEffect(() => { if (version !== previousVersion) { - dispatch(fetchUpdates()); + refetch(); } - }, [version, previousVersion, dispatch]); + }, [version, previousVersion, refetch]); return ( diff --git a/frontend/src/Store/Actions/systemActions.js b/frontend/src/Store/Actions/systemActions.js index 206183693..90cab9a20 100644 --- a/frontend/src/Store/Actions/systemActions.js +++ b/frontend/src/Store/Actions/systemActions.js @@ -80,8 +80,6 @@ export const RESTORE_BACKUP = 'system/backups/restoreBackup'; export const CLEAR_RESTORE_BACKUP = 'system/backups/clearRestoreBackup'; export const DELETE_BACKUP = 'system/backups/deleteBackup'; -export const FETCH_UPDATES = 'system/updates/fetchUpdates'; - export const RESTART = 'system/restart'; export const SHUTDOWN = 'system/shutdown'; @@ -100,8 +98,6 @@ export const restoreBackup = createThunk(RESTORE_BACKUP); export const clearRestoreBackup = createAction(CLEAR_RESTORE_BACKUP); export const deleteBackup = createThunk(DELETE_BACKUP); -export const fetchUpdates = createThunk(FETCH_UPDATES); - export const restart = createThunk(RESTART); export const shutdown = createThunk(SHUTDOWN); @@ -180,8 +176,6 @@ export const actionHandlers = handleThunks({ [DELETE_BACKUP]: createRemoveItemHandler(backupsSection, '/system/backup'), - [FETCH_UPDATES]: createFetchHandler('system.updates', '/update'), - [RESTART]: function(getState, payload, dispatch) { const promise = createAjaxRequest({ url: '/system/restart', diff --git a/frontend/src/System/Updates/Updates.tsx b/frontend/src/System/Updates/Updates.tsx index 34ef64659..28bfbe7b7 100644 --- a/frontend/src/System/Updates/Updates.tsx +++ b/frontend/src/System/Updates/Updates.tsx @@ -15,7 +15,6 @@ import { icons, kinds } from 'Helpers/Props'; import useUpdateSettings from 'Settings/General/useUpdateSettings'; import { executeCommand } from 'Store/Actions/commandActions'; import { fetchGeneralSettings } from 'Store/Actions/settingsActions'; -import { fetchUpdates } from 'Store/Actions/systemActions'; import createCommandExecutingSelector from 'Store/Selectors/createCommandExecutingSelector'; import createSystemStatusSelector from 'Store/Selectors/createSystemStatusSelector'; import createUISettingsSelector from 'Store/Selectors/createUISettingsSelector'; @@ -114,7 +113,6 @@ function Updates() { }, [setIsMajorUpdateModalOpen]); useEffect(() => { - dispatch(fetchUpdates()); dispatch(fetchGeneralSettings()); }, [dispatch]);