fix relationship not loading on hover card

This commit is contained in:
Mary Kate 2020-08-10 12:08:32 -05:00
parent b30dc39f1a
commit 5998f52e9f

View file

@ -10,6 +10,7 @@ import ActionButton from '../ui/components/action_button';
import { isAdmin, isModerator } from 'soapbox/utils/accounts'; import { isAdmin, isModerator } from 'soapbox/utils/accounts';
import Badge from 'soapbox/components/badge'; import Badge from 'soapbox/components/badge';
import classNames from 'classnames'; import classNames from 'classnames';
import { fetchRelationships } from 'soapbox/actions/accounts';
const getAccount = makeGetAccount(); const getAccount = makeGetAccount();
@ -19,11 +20,7 @@ const mapStateToProps = (state, { accountId }) => {
}; };
}; };
const mapDispatchToProps = (dispatch) => ({ export default @connect(mapStateToProps)
});
export default @connect(mapStateToProps, mapDispatchToProps)
@injectIntl @injectIntl
class ProfileHoverCardContainer extends ImmutablePureComponent { class ProfileHoverCardContainer extends ImmutablePureComponent {
@ -32,6 +29,7 @@ class ProfileHoverCardContainer extends ImmutablePureComponent {
accountId: PropTypes.string, accountId: PropTypes.string,
account: ImmutablePropTypes.map, account: ImmutablePropTypes.map,
intl: PropTypes.object.isRequired, intl: PropTypes.object.isRequired,
dispatch: PropTypes.func.isRequired,
} }
static defaultProps = { static defaultProps = {
@ -47,6 +45,10 @@ class ProfileHoverCardContainer extends ImmutablePureComponent {
return badges; return badges;
} }
componentDidMount() {
this.props.dispatch(fetchRelationships([this.props.accountId]));
}
render() { render() {
const { visible, accountId, account } = this.props; const { visible, accountId, account } = this.props;
if (!accountId) return null; if (!accountId) return null;