Fixed console error thrown by PostList when switching teams (#5960)

Этот коммит содержится в:
Harrison Healey
2017-04-04 00:21:47 -04:00
коммит произвёл Corey Hulen
родитель 410aaab6c5
Коммит 5cd0d5b87e

Просмотреть файл

@@ -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;