From 5cd0d5b87eb282c8ae60b1a0b68dfb76b63d5a0e Mon Sep 17 00:00:00 2001 From: Harrison Healey Date: Tue, 4 Apr 2017 00:21:47 -0400 Subject: [PATCH] Fixed console error thrown by PostList when switching teams (#5960) --- webapp/components/post_view/components/post_list.jsx | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/webapp/components/post_view/components/post_list.jsx b/webapp/components/post_view/components/post_list.jsx index 10dad8a722..a5369454d3 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;