diff --git a/frontend/src/Album/Search/AlbumInteractiveSearchModalConnector.js b/frontend/src/Album/Search/AlbumInteractiveSearchModalConnector.js index 5b23395fb..ac10cd146 100644 --- a/frontend/src/Album/Search/AlbumInteractiveSearchModalConnector.js +++ b/frontend/src/Album/Search/AlbumInteractiveSearchModalConnector.js @@ -1,9 +1,19 @@ +import PropTypes from 'prop-types'; +import React, { Component } from 'react'; import { connect } from 'react-redux'; import { cancelFetchReleases, clearReleases } from 'Store/Actions/releaseActions'; import AlbumInteractiveSearchModal from './AlbumInteractiveSearchModal'; function createMapDispatchToProps(dispatch, props) { return { + dispatchCancelFetchReleases() { + dispatch(cancelFetchReleases()); + }, + + dispatchClearReleases() { + dispatch(clearReleases()); + }, + onModalClose() { dispatch(cancelFetchReleases()); dispatch(clearReleases()); @@ -12,4 +22,38 @@ function createMapDispatchToProps(dispatch, props) { }; } -export default connect(null, createMapDispatchToProps)(AlbumInteractiveSearchModal); +class AlbumInteractiveSearchModalConnector extends Component { + + // + // Lifecycle + + componentWillUnmount() { + this.props.dispatchCancelFetchReleases(); + this.props.dispatchClearReleases(); + } + + // + // Render + + render() { + const { + dispatchCancelFetchReleases, + dispatchClearReleases, + ...otherProps + } = this.props; + + return ( + + ); + } +} + +AlbumInteractiveSearchModalConnector.propTypes = { + ...AlbumInteractiveSearchModal.propTypes, + dispatchCancelFetchReleases: PropTypes.func.isRequired, + dispatchClearReleases: PropTypes.func.isRequired +}; + +export default connect(null, createMapDispatchToProps)(AlbumInteractiveSearchModalConnector); diff --git a/frontend/src/Artist/Search/ArtistInteractiveSearchModalConnector.js b/frontend/src/Artist/Search/ArtistInteractiveSearchModalConnector.js index fe3170570..6706a27fa 100644 --- a/frontend/src/Artist/Search/ArtistInteractiveSearchModalConnector.js +++ b/frontend/src/Artist/Search/ArtistInteractiveSearchModalConnector.js @@ -1,9 +1,19 @@ +import PropTypes from 'prop-types'; +import React, { Component } from 'react'; import { connect } from 'react-redux'; import { cancelFetchReleases, clearReleases } from 'Store/Actions/releaseActions'; import ArtistInteractiveSearchModal from './ArtistInteractiveSearchModal'; function createMapDispatchToProps(dispatch, props) { return { + dispatchCancelFetchReleases() { + dispatch(cancelFetchReleases()); + }, + + dispatchClearReleases() { + dispatch(clearReleases()); + }, + onModalClose() { dispatch(cancelFetchReleases()); dispatch(clearReleases()); @@ -12,4 +22,38 @@ function createMapDispatchToProps(dispatch, props) { }; } -export default connect(null, createMapDispatchToProps)(ArtistInteractiveSearchModal); +class ArtistInteractiveSearchModalConnector extends Component { + + // + // Lifecycle + + componentWillUnmount() { + this.props.dispatchCancelFetchReleases(); + this.props.dispatchClearReleases(); + } + + // + // Render + + render() { + const { + dispatchCancelFetchReleases, + dispatchClearReleases, + ...otherProps + } = this.props; + + return ( + + ); + } +} + +ArtistInteractiveSearchModalConnector.propTypes = { + ...ArtistInteractiveSearchModal.propTypes, + dispatchCancelFetchReleases: PropTypes.func.isRequired, + dispatchClearReleases: PropTypes.func.isRequired +}; + +export default connect(null, createMapDispatchToProps)(ArtistInteractiveSearchModalConnector);