fix comments merge

This commit is contained in:
feruz 2020-01-13 13:27:46 +02:00
parent e3a346791d
commit 70b4b3f449

View File

@ -23,6 +23,7 @@ import { getIsFavorite, addFavorite, removeFavorite } from '../providers/esteem/
// Utilitites // Utilitites
import { getRcPower, getVotingPower } from '../utils/manaBar'; import { getRcPower, getVotingPower } from '../utils/manaBar';
import { unionWith } from '../utils/postParser';
// Constants // Constants
import { default as ROUTES } from '../constants/routeNames'; import { default as ROUTES } from '../constants/routeNames';
@ -77,7 +78,7 @@ class ProfileContainer extends Component {
} }
_getReplies = async query => { _getReplies = async query => {
const { isOwnProfile } = this.state; const { isOwnProfile, comments } = this.state;
let repliesAction; let repliesAction;
if (!isOwnProfile) { if (!isOwnProfile) {
@ -85,16 +86,18 @@ class ProfileContainer extends Component {
} else { } else {
repliesAction = getRepliesByLastUpdate; repliesAction = getRepliesByLastUpdate;
} }
if (query) {
await repliesAction({ await repliesAction({
start_author: query.author, start_author: query.author,
start_permlink: query.permlink, start_permlink: query.permlink,
limit: 10, limit: 10,
}).then(result => { }).then(result => {
this.setState({ let _comments = unionWith(comments, result, 'permlink');
comments: result, this.setState({
comments: _comments,
});
}); });
}); }
}; };
_handleFollowUnfollowUser = async isFollowAction => { _handleFollowUnfollowUser = async isFollowAction => {