Refactoring redux state into different reducers

This commit is contained in:
Eugen Rochko
2016-10-30 15:06:43 +01:00
parent 7060bdf04b
commit e8ff4c8e56
23 changed files with 352 additions and 223 deletions

View File

@ -26,7 +26,7 @@ const makeMapStateToProps = () => {
const mapStateToProps = (state, props) => ({
account: getAccount(state, Number(props.params.accountId)),
me: state.getIn(['timelines', 'me'])
me: state.getIn(['meta', 'me'])
});
return mapStateToProps;

View File

@ -10,7 +10,7 @@ import LoadingIndicator from '../../components/loading_indicator';
const mapStateToProps = (state, props) => ({
statusIds: state.getIn(['timelines', 'accounts_timelines', Number(props.params.accountId)]),
me: state.getIn(['timelines', 'me'])
me: state.getIn(['meta', 'me'])
});
const AccountTimeline = React.createClass({

View File

@ -2,7 +2,7 @@ import { connect } from 'react-redux';
import SuggestionsBox from '../components/suggestions_box';
const mapStateToProps = (state) => ({
accountIds: state.get('suggestions')
accountIds: state.getIn(['user_lists', 'suggestions'])
});
export default connect(mapStateToProps)(SuggestionsBox);

View File

@ -11,7 +11,7 @@ const makeMapStateToProps = () => {
const mapStateToProps = (state, props) => ({
account: getAccount(state, props.id),
me: state.getIn(['timelines', 'me'])
me: state.getIn(['meta', 'me'])
});
return mapStateToProps;

View File

@ -31,7 +31,7 @@ const makeMapStateToProps = () => {
status: getStatus(state, Number(props.params.statusId)),
ancestorsIds: state.getIn(['timelines', 'ancestors', Number(props.params.statusId)]),
descendantsIds: state.getIn(['timelines', 'descendants', Number(props.params.statusId)]),
me: state.getIn(['timelines', 'me'])
me: state.getIn(['meta', 'me'])
});
return mapStateToProps;
@ -43,8 +43,8 @@ const Status = React.createClass({
params: React.PropTypes.object.isRequired,
dispatch: React.PropTypes.func.isRequired,
status: ImmutablePropTypes.map,
ancestorsIds: ImmutablePropTypes.orderedSet,
descendantsIds: ImmutablePropTypes.orderedSet
ancestorsIds: ImmutablePropTypes.list,
descendantsIds: ImmutablePropTypes.list
},
mixins: [PureRenderMixin],
@ -101,11 +101,11 @@ const Status = React.createClass({
const account = status.get('account');
if (ancestorsIds) {
if (ancestorsIds && ancestorsIds.size > 0) {
ancestors = <div>{this.renderChildren(ancestorsIds)}</div>;
}
if (descendantsIds) {
if (descendantsIds && descendantsIds.size > 0) {
descendants = <div>{this.renderChildren(descendantsIds)}</div>;
}

View File

@ -2,7 +2,7 @@ import { connect } from 'react-redux';
import NavigationBar from '../components/navigation_bar';
const mapStateToProps = (state, props) => ({
account: state.getIn(['timelines', 'accounts', state.getIn(['timelines', 'me'])])
account: state.getIn(['accounts', state.getIn(['meta', 'me'])])
});
export default connect(mapStateToProps)(NavigationBar);