Fixed console error thrown by PostList when switching teams (#5960)
Этот коммит содержится в:
коммит произвёл
Corey Hulen
родитель
410aaab6c5
Коммит
5cd0d5b87e
@@ -104,6 +104,10 @@ export default class PostList extends React.Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
isAtBottom() {
|
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
|
// consider the view to be at the bottom if it's within this many pixels of the bottom
|
||||||
const atBottomMargin = 10;
|
const atBottomMargin = 10;
|
||||||
|
|
||||||
@@ -135,6 +139,10 @@ export default class PostList extends React.Component {
|
|||||||
// Postpone all DOM related calculations to next frame.
|
// Postpone all DOM related calculations to next frame.
|
||||||
// scrollHeight etc might return wrong data at this point
|
// scrollHeight etc might return wrong data at this point
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
|
if (!this.refs.postlist) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
this.wasAtBottom = this.isAtBottom();
|
this.wasAtBottom = this.isAtBottom();
|
||||||
this.props.postListScrolled(this.isAtBottom());
|
this.props.postListScrolled(this.isAtBottom());
|
||||||
this.prevScrollHeight = this.refs.postlist.scrollHeight;
|
this.prevScrollHeight = this.refs.postlist.scrollHeight;
|
||||||
|
|||||||
Ссылка в новой задаче
Block a user