summaryrefslogtreecommitdiffstats
path: root/webapp/components
diff options
context:
space:
mode:
authorHarrison Healey <harrisonmhealey@gmail.com>2017-04-04 00:21:47 -0400
committerCorey Hulen <corey@hulen.com>2017-04-03 21:21:47 -0700
commit5cd0d5b87eb282c8ae60b1a0b68dfb76b63d5a0e (patch)
tree052fdd404233e93f53627d0e0ee18019b404ebde /webapp/components
parent410aaab6c5072fddd36d87b51a83d242cc9b59b1 (diff)
downloadchat-5cd0d5b87eb282c8ae60b1a0b68dfb76b63d5a0e.tar.gz
chat-5cd0d5b87eb282c8ae60b1a0b68dfb76b63d5a0e.tar.bz2
chat-5cd0d5b87eb282c8ae60b1a0b68dfb76b63d5a0e.zip
Fixed console error thrown by PostList when switching teams (#5960)
Diffstat (limited to 'webapp/components')
-rw-r--r--webapp/components/post_view/components/post_list.jsx8
1 files changed, 8 insertions, 0 deletions
diff --git a/webapp/components/post_view/components/post_list.jsx b/webapp/components/post_view/components/post_list.jsx
index 10dad8a72..a5369454d 100644
--- a/webapp/components/post_view/components/post_list.jsx
+++ b/webapp/components/post_view/components/post_list.jsx
@@ -104,6 +104,10 @@ export default class PostList extends React.Component {
}
isAtBottom() {
+ if (!this.refs.postlist) {
+ return this.wasAtBottom;
+ }
+
// consider the view to be at the bottom if it's within this many pixels of the bottom
const atBottomMargin = 10;
@@ -135,6 +139,10 @@ export default class PostList extends React.Component {
// Postpone all DOM related calculations to next frame.
// scrollHeight etc might return wrong data at this point
setTimeout(() => {
+ if (!this.refs.postlist) {
+ return;
+ }
+
this.wasAtBottom = this.isAtBottom();
this.props.postListScrolled(this.isAtBottom());
this.prevScrollHeight = this.refs.postlist.scrollHeight;