From 24aba5084b3b4ffec35131c722af9a93dbb13371 Mon Sep 17 00:00:00 2001 From: Chi Vinh Le Date: Mon, 3 Apr 2017 14:37:46 +0700 Subject: [PATCH] Only bind action creators once --- client/coral-embed-stream/src/Embed.js | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/client/coral-embed-stream/src/Embed.js b/client/coral-embed-stream/src/Embed.js index 68f4658aa..e4d0e2000 100644 --- a/client/coral-embed-stream/src/Embed.js +++ b/client/coral-embed-stream/src/Embed.js @@ -40,6 +40,7 @@ import NewCount from './NewCount'; class Embed extends Component { state = {activeTab: 0, showSignInDialog: false, activeReplyBox: ''}; + pluginActions = {} changeTab = (tab) => { @@ -66,6 +67,11 @@ class Embed extends Component { removeCommentTag: React.PropTypes.func, } + constructor(props) { + super(props); + this.pluginActions = bindActionCreators(actions.pluginActions, props.dispatch); + } + componentDidMount () { pym.sendMessage('childReady'); } @@ -122,14 +128,12 @@ class Embed extends Component { * Plugins Section * */ - const {dispatch, state, ...currentProps} = this.props; - const {pluginActions} = actions; - let boundActionCreators = bindActionCreators(pluginActions, dispatch); + const {state, ...currentProps} = this.props; const pluginProps = { state, context: currentProps, - actions: boundActionCreators + actions: this.pluginActions, }; return (