diff --git a/src/app/Sidebar/RightSidebar.js b/src/app/Sidebar/RightSidebar.js
index e0a227ce7d..de832aae73 100644
--- a/src/app/Sidebar/RightSidebar.js
+++ b/src/app/Sidebar/RightSidebar.js
@@ -8,6 +8,7 @@ import {
getIsAuthenticated,
getAuthenticatedUser,
getFollowingList,
+ getIsAuthFetching,
} from '../../reducers';
import InterestingPeople from '../../components/Sidebar/InterestingPeople';
@@ -20,6 +21,7 @@ import PostRecommendation from '../../components/Sidebar/PostRecommendation';
authenticated: getIsAuthenticated(state),
authenticatedUser: getAuthenticatedUser(state),
followingList: getFollowingList(state),
+ isAuthFetching: getIsAuthFetching(state),
}),
)
export default class RightSidebar extends React.Component {
@@ -27,6 +29,7 @@ export default class RightSidebar extends React.Component {
authenticated: PropTypes.bool.isRequired,
authenticatedUser: PropTypes.shape().isRequired,
followingList: PropTypes.arrayOf(PropTypes.string).isRequired,
+ isAuthFetching: PropTypes.bool.isRequired,
showPostRecommendation: PropTypes.bool,
};
@@ -58,7 +61,7 @@ export default class RightSidebar extends React.Component {
});
render() {
- const { authenticated, authenticatedUser, showPostRecommendation } = this.props;
+ const { authenticated, authenticatedUser, showPostRecommendation, isAuthFetching } = this.props;
const InterestingPeopleWithData = () => (
: }
- {showPostRecommendation && }
+ {showPostRecommendation && }
);
}
diff --git a/src/components/Sidebar/PostRecommendation.js b/src/components/Sidebar/PostRecommendation.js
index f51caf37f3..a35d1faf44 100644
--- a/src/components/Sidebar/PostRecommendation.js
+++ b/src/components/Sidebar/PostRecommendation.js
@@ -13,6 +13,7 @@ class PostRecommendation extends Component {
location: PropTypes.shape().isRequired,
intl: PropTypes.shape().isRequired,
history: PropTypes.shape().isRequired,
+ isAuthFetching: PropTypes.bool.isRequired,
};
state = {
@@ -22,8 +23,8 @@ class PostRecommendation extends Component {
};
componentWillMount() {
- const { location } = this.props;
- if (location.pathname !== '/') {
+ const { location, isAuthFetching } = this.props;
+ if (!isAuthFetching && location.pathname !== '/') {
const currentAuthor = location.pathname.split('/')[2].replace('@', '');
this.setState({
loading: true,
@@ -32,6 +33,16 @@ class PostRecommendation extends Component {
}
}
+ componentWillReceiveProps(nextProps) {
+ if (this.props.isAuthFetching !== nextProps.isAuthFetching) {
+ const currentAuthor = this.props.location.pathname.split('/')[2].replace('@', '');
+ this.setState({
+ loading: true,
+ });
+ this.getPostsByAuthor(currentAuthor);
+ }
+ }
+
getPostsByAuthor = (author) => {
steemAPI
.getDiscussionsByBlogAsync({