Fixed: Clear season search results when navigating to another page

This commit is contained in:
Bogdan 2023-08-02 03:02:25 +03:00 committed by GitHub
parent a5aab810d7
commit 67dc898797
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 47 additions and 2 deletions

View File

@ -63,7 +63,7 @@ class EpisodeDetailsModalContentConnector extends Component {
// Lifecycle // Lifecycle
componentWillUnmount() { componentWillUnmount() {
// Clear pending releases here so we can reshow the search // Clear pending releases here, so we can reshow the search
// results even after switching tabs. // results even after switching tabs.
this.props.dispatchCancelFetchReleases(); this.props.dispatchCancelFetchReleases();
@ -75,6 +75,7 @@ class EpisodeDetailsModalContentConnector extends Component {
render() { render() {
const { const {
dispatchCancelFetchReleases,
dispatchClearReleases, dispatchClearReleases,
...otherProps ...otherProps
} = this.props; } = this.props;

View File

@ -1,9 +1,19 @@
import PropTypes from 'prop-types';
import React, { Component } from 'react';
import { connect } from 'react-redux'; import { connect } from 'react-redux';
import { cancelFetchReleases, clearReleases } from 'Store/Actions/releaseActions'; import { cancelFetchReleases, clearReleases } from 'Store/Actions/releaseActions';
import SeasonInteractiveSearchModal from './SeasonInteractiveSearchModal'; import SeasonInteractiveSearchModal from './SeasonInteractiveSearchModal';
function createMapDispatchToProps(dispatch, props) { function createMapDispatchToProps(dispatch, props) {
return { return {
dispatchCancelFetchReleases() {
dispatch(cancelFetchReleases());
},
dispatchClearReleases() {
dispatch(clearReleases());
},
onModalClose() { onModalClose() {
dispatch(cancelFetchReleases()); dispatch(cancelFetchReleases());
dispatch(clearReleases()); dispatch(clearReleases());
@ -12,4 +22,38 @@ function createMapDispatchToProps(dispatch, props) {
}; };
} }
export default connect(null, createMapDispatchToProps)(SeasonInteractiveSearchModal); class SeasonInteractiveSearchModalConnector extends Component {
//
// Lifecycle
componentWillUnmount() {
this.props.dispatchCancelFetchReleases();
this.props.dispatchClearReleases();
}
//
// Render
render() {
const {
dispatchCancelFetchReleases,
dispatchClearReleases,
...otherProps
} = this.props;
return (
<SeasonInteractiveSearchModal
{...otherProps}
/>
);
}
}
SeasonInteractiveSearchModalConnector.propTypes = {
...SeasonInteractiveSearchModal.propTypes,
dispatchCancelFetchReleases: PropTypes.func.isRequired,
dispatchClearReleases: PropTypes.func.isRequired
};
export default connect(null, createMapDispatchToProps)(SeasonInteractiveSearchModalConnector);