mattermost-mobile/app/screens/thread/index.js
enahum 27713322e3 Fixed Search bugs and avoid re-renders (#1047)
* Fixed Search and avoid re-renders

* Feedback review

* Feedback review
2017-10-24 17:02:09 -04:00

42 lines
1.4 KiB
JavaScript

// Copyright (c) 2017-present Mattermost, Inc. All Rights Reserved.
// See License.txt for license information.
import {bindActionCreators} from 'redux';
import {connect} from 'react-redux';
import {getTheme} from 'mattermost-redux/selectors/entities/preferences';
import {selectPost} from 'mattermost-redux/actions/posts';
import {getMyCurrentChannelMembership, makeGetChannel} from 'mattermost-redux/selectors/entities/channels';
import {makeGetPostIdsForThread} from 'mattermost-redux/selectors/entities/posts';
import Thread from './thread';
function makeMapStateToProps() {
const getPostIdsForThread = makeGetPostIdsForThread();
const getChannel = makeGetChannel();
return function mapStateToProps(state, ownProps) {
const channel = getChannel(state, {id: ownProps.channelId});
return {
channelId: ownProps.channelId,
channelType: channel.type,
displayName: channel.display_name,
myMember: getMyCurrentChannelMembership(state),
rootId: ownProps.rootId,
postIds: getPostIdsForThread(state, ownProps.rootId),
theme: getTheme(state)
};
};
}
function mapDispatchToProps(dispatch) {
return {
actions: bindActionCreators({
selectPost
}, dispatch)
};
}
export default connect(makeMapStateToProps, mapDispatchToProps)(Thread);