Browse Source

Fix not reloading account/fetching relationship on newly independent components

closed-social-v3
Eugen Rochko 7 years ago
parent
commit
86b3cb5120
3 changed files with 9 additions and 0 deletions
  1. +3
    -0
      app/assets/javascripts/components/features/account_timeline/index.jsx
  2. +3
    -0
      app/assets/javascripts/components/features/followers/index.jsx
  3. +3
    -0
      app/assets/javascripts/components/features/following/index.jsx

+ 3
- 0
app/assets/javascripts/components/features/account_timeline/index.jsx View File

@ -2,6 +2,7 @@ import { connect } from 'react-redux';
import PureRenderMixin from 'react-addons-pure-render-mixin';
import ImmutablePropTypes from 'react-immutable-proptypes';
import {
fetchAccount,
fetchAccountTimeline,
expandAccountTimeline
} from '../../actions/accounts';
@ -30,11 +31,13 @@ const AccountTimeline = React.createClass({
mixins: [PureRenderMixin],
componentWillMount () {
this.props.dispatch(fetchAccount(Number(this.props.params.accountId)));
this.props.dispatch(fetchAccountTimeline(Number(this.props.params.accountId)));
},
componentWillReceiveProps(nextProps) {
if (nextProps.params.accountId !== this.props.params.accountId && nextProps.params.accountId) {
this.props.dispatch(fetchAccount(Number(nextProps.params.accountId)));
this.props.dispatch(fetchAccountTimeline(Number(nextProps.params.accountId)));
}
},

+ 3
- 0
app/assets/javascripts/components/features/followers/index.jsx View File

@ -3,6 +3,7 @@ import PureRenderMixin from 'react-addons-pure-render-mixin';
import ImmutablePropTypes from 'react-immutable-proptypes';
import LoadingIndicator from '../../components/loading_indicator';
import {
fetchAccount,
fetchFollowers,
expandFollowers
} from '../../actions/accounts';
@ -28,11 +29,13 @@ const Followers = React.createClass({
mixins: [PureRenderMixin],
componentWillMount () {
this.props.dispatch(fetchAccount(Number(this.props.params.accountId)));
this.props.dispatch(fetchFollowers(Number(this.props.params.accountId)));
},
componentWillReceiveProps(nextProps) {
if (nextProps.params.accountId !== this.props.params.accountId && nextProps.params.accountId) {
this.props.dispatch(fetchAccount(Number(nextProps.params.accountId)));
this.props.dispatch(fetchFollowers(Number(nextProps.params.accountId)));
}
},

+ 3
- 0
app/assets/javascripts/components/features/following/index.jsx View File

@ -3,6 +3,7 @@ import PureRenderMixin from 'react-addons-pure-render-mixin';
import ImmutablePropTypes from 'react-immutable-proptypes';
import LoadingIndicator from '../../components/loading_indicator';
import {
fetchAccount,
fetchFollowing,
expandFollowing
} from '../../actions/accounts';
@ -28,11 +29,13 @@ const Following = React.createClass({
mixins: [PureRenderMixin],
componentWillMount () {
this.props.dispatch(fetchAccount(Number(this.props.params.accountId)));
this.props.dispatch(fetchFollowing(Number(this.props.params.accountId)));
},
componentWillReceiveProps(nextProps) {
if (nextProps.params.accountId !== this.props.params.accountId && nextProps.params.accountId) {
this.props.dispatch(fetchAccount(Number(nextProps.params.accountId)));
this.props.dispatch(fetchFollowing(Number(nextProps.params.accountId)));
}
},

Loading…
Cancel
Save