From 0c663216cc52f6cccdab23a28d0420d4b30e7149 Mon Sep 17 00:00:00 2001 From: Joram Wilander Date: Thu, 20 Oct 2016 14:26:15 -0400 Subject: Fix scrolling issues caused by performance branch (#4285) --- webapp/components/post_view/components/post_list.jsx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'webapp/components/post_view') diff --git a/webapp/components/post_view/components/post_list.jsx b/webapp/components/post_view/components/post_list.jsx index 46ce0ed67..8e1d58e15 100644 --- a/webapp/components/post_view/components/post_list.jsx +++ b/webapp/components/post_view/components/post_list.jsx @@ -392,15 +392,15 @@ export default class PostList extends React.Component { if (this.props.scrollType === ScrollTypes.BOTTOM) { this.scrollToBottom(); } else if (this.props.scrollType === ScrollTypes.NEW_MESSAGE) { - window.setTimeout(window.requestAnimationFrame(() => { + window.requestAnimationFrame(() => { // If separator exists scroll to it. Otherwise scroll to bottom. if (this.refs.newMessageSeparator) { var objDiv = this.refs.postlist; objDiv.scrollTop = this.refs.newMessageSeparator.offsetTop; //scrolls node to top of Div } else if (this.refs.postlist) { - this.refs.postlist.scrollTop = this.refs.postlist.scrollHeight; + this.scrollToBottom(); } - }), 0); + }); } else if (this.props.scrollType === ScrollTypes.POST && this.props.scrollPostId) { window.requestAnimationFrame(() => { const postNode = ReactDOM.findDOMNode(this.refs[this.props.scrollPostId]); -- cgit v1.2.3-1-g7c22