From 1abea1e0c222fe066e3a878abaed2dbe42918856 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9goire=20Delattre?= Date: Tue, 23 May 2017 20:16:29 +0200 Subject: [PATCH] Only map the required props/funcs to the show view --- src/public/js/components/shows/details.js | 20 +++++++++++--------- src/public/js/routes.js | 2 +- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/src/public/js/components/shows/details.js b/src/public/js/components/shows/details.js index bb68de9..e1faea5 100644 --- a/src/public/js/components/shows/details.js +++ b/src/public/js/components/shows/details.js @@ -1,7 +1,8 @@ import React from 'react' import { connect } from 'react-redux' import { bindActionCreators } from 'redux' -import * as actionCreators from '../../actions/actionCreators' +import { addTorrent, addShowToWishlist, deleteFromWishlist, + updateShowDetails, updateEpisodeDetailsStore, getEpisodeDetails } from '../../actions/actionCreators' import Loader from '../loader/loader' import DownloadButton from '../buttons/download' @@ -9,29 +10,30 @@ import DownloadButton from '../buttons/download' import { OverlayTrigger, Tooltip } from 'react-bootstrap' function mapStateToProps(state) { - return { showStore: state.showStore }; + return { + loading: state.showStore.loading, + show: state.showStore.show, + }; } const mapDispatchToProps = (dispatch) => - bindActionCreators(actionCreators, dispatch) + bindActionCreators({addTorrent, addShowToWishlist, deleteFromWishlist, + updateShowDetails, updateEpisodeDetailsStore, getEpisodeDetails }, dispatch) class ShowDetails extends React.Component { - componentWillMount() { - this.props.fetchShowDetails(this.props.params.imdbId); - } render() { // Loading - if (this.props.showStore.loading) { + if (this.props.loading) { return (); } return (