about summary refs log tree commit diff
diff options
context:
space:
mode:
authorunarist <m.unarist@gmail.com>2017-07-20 03:26:51 +0900
committerEugen Rochko <eugen@zeonfederated.com>2017-07-19 20:26:51 +0200
commit4f2513337f77a9f05883b82e5b6a6e3a0dc10b14 (patch)
tree46d7150fc346fecfd41535ca10b9b7d16cd2bde6
parent015269914e0908799a4a958fe8af39cb81984986 (diff)
Update scroll top state on column mounting (#4276)
-rw-r--r--app/javascript/mastodon/components/status_list.js7
1 files changed, 5 insertions, 2 deletions
diff --git a/app/javascript/mastodon/components/status_list.js b/app/javascript/mastodon/components/status_list.js
index 86e8386bd..a8ea1ec5b 100644
--- a/app/javascript/mastodon/components/status_list.js
+++ b/app/javascript/mastodon/components/status_list.js
@@ -30,8 +30,8 @@ export default class StatusList extends ImmutablePureComponent {
 
   intersectionObserverWrapper = new IntersectionObserverWrapper();
 
-  handleScroll = debounce((e) => {
-    const { scrollTop, scrollHeight, clientHeight } = e.target;
+  handleScroll = debounce(() => {
+    const { scrollTop, scrollHeight, clientHeight } = this.node;
     const offset = scrollHeight - scrollTop - clientHeight;
     this._oldScrollPosition = scrollHeight - scrollTop;
 
@@ -49,6 +49,9 @@ export default class StatusList extends ImmutablePureComponent {
   componentDidMount () {
     this.attachScrollListener();
     this.attachIntersectionObserver();
+
+    // Handle initial scroll posiiton
+    this.handleScroll();
   }
 
   componentDidUpdate (prevProps) {