about summary refs log tree commit diff
path: root/app/javascript
diff options
context:
space:
mode:
authorSorin Davidoi <sorin.davidoi@gmail.com>2017-07-25 02:13:05 +0200
committerEugen Rochko <eugen@zeonfederated.com>2017-07-25 02:13:05 +0200
commit696bcff6bfe5250bae06d3c252f46dbe6ac65624 (patch)
tree14b909b8927f50e23bb8ce0a6124044ee47eedfb /app/javascript
parentf52ce92f2bc989154a69d20ab12cad927f94bc24 (diff)
fix(status_list): Guard against missing ref (#4353)
Diffstat (limited to 'app/javascript')
-rw-r--r--app/javascript/mastodon/components/status_list.js22
1 files changed, 12 insertions, 10 deletions
diff --git a/app/javascript/mastodon/components/status_list.js b/app/javascript/mastodon/components/status_list.js
index 98f0de0a8..dc6f956bf 100644
--- a/app/javascript/mastodon/components/status_list.js
+++ b/app/javascript/mastodon/components/status_list.js
@@ -31,16 +31,18 @@ export default class StatusList extends ImmutablePureComponent {
   intersectionObserverWrapper = new IntersectionObserverWrapper();
 
   handleScroll = debounce(() => {
-    const { scrollTop, scrollHeight, clientHeight } = this.node;
-    const offset = scrollHeight - scrollTop - clientHeight;
-    this._oldScrollPosition = scrollHeight - scrollTop;
-
-    if (250 > offset && this.props.onScrollToBottom && !this.props.isLoading) {
-      this.props.onScrollToBottom();
-    } else if (scrollTop < 100 && this.props.onScrollToTop) {
-      this.props.onScrollToTop();
-    } else if (this.props.onScroll) {
-      this.props.onScroll();
+    if (this.node) {
+      const { scrollTop, scrollHeight, clientHeight } = this.node;
+      const offset = scrollHeight - scrollTop - clientHeight;
+      this._oldScrollPosition = scrollHeight - scrollTop;
+
+      if (250 > offset && this.props.onScrollToBottom && !this.props.isLoading) {
+        this.props.onScrollToBottom();
+      } else if (scrollTop < 100 && this.props.onScrollToTop) {
+        this.props.onScrollToTop();
+      } else if (this.props.onScroll) {
+        this.props.onScroll();
+      }
     }
   }, 200, {
     trailing: true,