summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoram Wilander <jwawilander@gmail.com>2015-09-09 11:39:45 -0400
committerJoram Wilander <jwawilander@gmail.com>2015-09-09 11:39:45 -0400
commite6d4661aba8c25901329bd3fcff8e01ddc6ae600 (patch)
tree4c69ffeeabb7ef081e6bd4e9a4cb7d8d1fa983ed
parent2c67b4db61fb896854906c096b02290935fb9c7f (diff)
parentd30426ce17a6aa611c8712d3315d5249cbbeee92 (diff)
downloadchat-e6d4661aba8c25901329bd3fcff8e01ddc6ae600.tar.gz
chat-e6d4661aba8c25901329bd3fcff8e01ddc6ae600.tar.bz2
chat-e6d4661aba8c25901329bd3fcff8e01ddc6ae600.zip
Merge pull request #632 from mattermost/new-msg-scroll-fix
Fix race condition where switching between two channels that both had…
-rw-r--r--web/react/components/post_list.jsx10
1 files changed, 7 insertions, 3 deletions
diff --git a/web/react/components/post_list.jsx b/web/react/components/post_list.jsx
index d7c0d4862..9d95887d9 100644
--- a/web/react/components/post_list.jsx
+++ b/web/react/components/post_list.jsx
@@ -152,6 +152,10 @@ export default class PostList extends React.Component {
postHolder.off('scroll');
}
componentDidUpdate(prevProps, prevState) {
+ if (!this.props.isActive) {
+ return;
+ }
+
$('.post-list__content div .post').removeClass('post--last');
$('.post-list__content div:last-child .post').addClass('post--last');
@@ -219,8 +223,8 @@ export default class PostList extends React.Component {
scrollToBottom(force) {
this.isUserScroll = false;
var postHolder = $(React.findDOMNode(this.refs.postlist));
- if ($('#new_message')[0] && !this.userHasSeenNew && !force) {
- $('#new_message')[0].scrollIntoView();
+ if ($('#new_message_' + this.props.channelId)[0] && !this.userHasSeenNew && !force) {
+ $('#new_message_' + this.props.channelId)[0].scrollIntoView();
} else {
postHolder.addClass('hide-scroll');
postHolder[0].scrollTop = postHolder[0].scrollHeight;
@@ -539,7 +543,7 @@ export default class PostList extends React.Component {
// Temporary fix to solve ie10/11 rendering issue
let newSeparatorId = '';
if (!utils.isBrowserIE()) {
- newSeparatorId = 'new_message';
+ newSeparatorId = 'new_message_' + this.props.channelId;
}
postCtls.push(
<div