diff --git a/src/components/posts/container/postsContainer.js b/src/components/posts/container/postsContainer.js index 6a7da4a06..51523c630 100644 --- a/src/components/posts/container/postsContainer.js +++ b/src/components/posts/container/postsContainer.js @@ -1,5 +1,6 @@ import React, { PureComponent, Fragment } from 'react'; import { connect } from 'react-redux'; +import get from 'lodash/get'; // Component import PostsView from '../view/postsView'; @@ -53,7 +54,9 @@ class PostsContainer extends PureComponent { return ( 0) { this.setState({ posts: _posts, diff --git a/src/redux/reducers/accountReducer.js b/src/redux/reducers/accountReducer.js index a9aa1789a..dfc5a9c36 100644 --- a/src/redux/reducers/accountReducer.js +++ b/src/redux/reducers/accountReducer.js @@ -1,3 +1,5 @@ +import get from 'lodash/get'; + import { FETCH_ACCOUNT_FAIL, FETCHING_ACCOUNT, @@ -45,7 +47,11 @@ export default function(state = initialState, action) { case ADD_OTHER_ACCOUNT: return { ...state, - otherAccounts: [...state.otherAccounts, action.payload], + otherAccounts: state.otherAccounts.some( + ({ username }) => username === get(action.payload, 'username'), + ) + ? [...state.otherAccounts] + : [...state.otherAccounts, action.payload], isFetching: false, hasError: false, errorMessage: null,