Fix load more posts bug.
Этот коммит содержится в:
@@ -152,7 +152,7 @@ export default class Post extends React.Component {
|
|||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
<div
|
<div
|
||||||
id={post.id}
|
id={'post_' + post.id}
|
||||||
className={'post ' + sameUserClass + ' ' + rootUser + ' ' + postType + ' ' + currentUserCss}
|
className={'post ' + sameUserClass + ' ' + rootUser + ' ' + postType + ' ' + currentUserCss}
|
||||||
>
|
>
|
||||||
{profilePic}
|
{profilePic}
|
||||||
|
|||||||
@@ -189,9 +189,15 @@ export default class PostList extends React.Component {
|
|||||||
this.scrollToBottom(true);
|
this.scrollToBottom(true);
|
||||||
|
|
||||||
// the user clicked 'load more messages'
|
// the user clicked 'load more messages'
|
||||||
} else if (this.gotMorePosts) {
|
} else if (this.gotMorePosts && oldOrder.length > 0) {
|
||||||
var lastPost = oldPosts[oldOrder[prevState.numToDisplay]];
|
let index;
|
||||||
$('#' + lastPost.id)[0].scrollIntoView();
|
if (prevState.numToDisplay >= oldOrder.length) {
|
||||||
|
index = oldOrder.length - 1;
|
||||||
|
} else {
|
||||||
|
index = prevState.numToDisplay;
|
||||||
|
}
|
||||||
|
const lastPost = oldPosts[oldOrder[index]];
|
||||||
|
$('#post_' + lastPost.id)[0].scrollIntoView();
|
||||||
this.gotMorePosts = false;
|
this.gotMorePosts = false;
|
||||||
} else {
|
} else {
|
||||||
this.scrollTo(this.prevScrollTop);
|
this.scrollTo(this.prevScrollTop);
|
||||||
|
|||||||
Ссылка в новой задаче
Block a user