mirror of
https://github.com/wassname/talk.git
synced 2026-07-23 13:10:20 +08:00
Only bind action creators once
This commit is contained in:
@@ -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 (
|
||||
|
||||
Reference in New Issue
Block a user