1
0
mirror of https://github.com/Radarr/Radarr.git synced 2024-10-03 22:57:18 +02:00

Fixed: Movie grabbed history on interactive search

This commit is contained in:
Bogdan 2023-11-21 03:45:19 +02:00
parent bbffff78ed
commit b4562e6236
3 changed files with 25 additions and 6 deletions

View File

@ -2,6 +2,7 @@ import PropTypes from 'prop-types';
import React, { Component } from 'react'; import React, { Component } from 'react';
import { connect } from 'react-redux'; import { connect } from 'react-redux';
import { createSelector } from 'reselect'; import { createSelector } from 'reselect';
import { clearMovieHistory, fetchMovieHistory } from 'Store/Actions/movieHistoryActions';
import * as releaseActions from 'Store/Actions/releaseActions'; import * as releaseActions from 'Store/Actions/releaseActions';
import createClientSideCollectionSelector from 'Store/Selectors/createClientSideCollectionSelector'; import createClientSideCollectionSelector from 'Store/Selectors/createClientSideCollectionSelector';
import createUISettingsSelector from 'Store/Selectors/createUISettingsSelector'; import createUISettingsSelector from 'Store/Selectors/createUISettingsSelector';
@ -29,6 +30,14 @@ function createMapDispatchToProps(dispatch, props) {
dispatch(releaseActions.fetchReleases(payload)); dispatch(releaseActions.fetchReleases(payload));
}, },
dispatchFetchMovieHistory({ movieId }) {
dispatch(fetchMovieHistory({ movieId }));
},
dispatchClearMovieHistory() {
dispatch(clearMovieHistory());
},
onSortPress(sortKey, sortDirection) { onSortPress(sortKey, sortDirection) {
dispatch(releaseActions.setReleasesSort({ sortKey, sortDirection })); dispatch(releaseActions.setReleasesSort({ sortKey, sortDirection }));
}, },
@ -52,7 +61,8 @@ class InteractiveSearchConnector extends Component {
const { const {
searchPayload, searchPayload,
isPopulated, isPopulated,
dispatchFetchReleases dispatchFetchReleases,
dispatchFetchMovieHistory
} = this.props; } = this.props;
// If search results are not yet isPopulated fetch them, // If search results are not yet isPopulated fetch them,
@ -60,6 +70,12 @@ class InteractiveSearchConnector extends Component {
if (!isPopulated) { if (!isPopulated) {
dispatchFetchReleases(searchPayload); dispatchFetchReleases(searchPayload);
} }
dispatchFetchMovieHistory(searchPayload);
}
componentWillUnmount() {
this.props.dispatchClearMovieHistory();
} }
// //
@ -68,6 +84,8 @@ class InteractiveSearchConnector extends Component {
render() { render() {
const { const {
dispatchFetchReleases, dispatchFetchReleases,
dispatchFetchMovieHistory,
dispatchClearMovieHistory,
...otherProps ...otherProps
} = this.props; } = this.props;
@ -83,7 +101,9 @@ class InteractiveSearchConnector extends Component {
InteractiveSearchConnector.propTypes = { InteractiveSearchConnector.propTypes = {
searchPayload: PropTypes.object.isRequired, searchPayload: PropTypes.object.isRequired,
isPopulated: PropTypes.bool.isRequired, isPopulated: PropTypes.bool.isRequired,
dispatchFetchReleases: PropTypes.func.isRequired dispatchFetchReleases: PropTypes.func.isRequired,
dispatchFetchMovieHistory: PropTypes.func.isRequired,
dispatchClearMovieHistory: PropTypes.func.isRequired
}; };
export default connect(createMapStateToProps, createMapDispatchToProps)(InteractiveSearchConnector); export default connect(createMapStateToProps, createMapDispatchToProps)(InteractiveSearchConnector);

View File

@ -133,9 +133,9 @@ function InteractiveSearchRow(props: InteractiveSearchRowProps) {
longDateFormat, longDateFormat,
timeFormat, timeFormat,
grabError, grabError,
historyGrabbedData, historyGrabbedData = {} as MovieHistory,
historyFailedData, historyFailedData = {} as MovieHistory,
blocklistData, blocklistData = {} as MovieBlocklist,
searchPayload, searchPayload,
onGrabPress, onGrabPress,
} = props; } = props;

View File

@ -328,7 +328,6 @@ class MovieDetails extends Component {
<PageToolbarButton <PageToolbarButton
label={translate('History')} label={translate('History')}
iconName={icons.HISTORY} iconName={icons.HISTORY}
isDisabled={!hasMovieFiles}
onPress={this.onMovieHistoryPress} onPress={this.onMovieHistoryPress}
/> />