]> cat aescling's git repositories - mastodon.git/commitdiff
Update scroll top state on column mounting (#4276)
authorunarist <m.unarist@gmail.com>
Wed, 19 Jul 2017 18:26:51 +0000 (03:26 +0900)
committerEugen Rochko <eugen@zeonfederated.com>
Wed, 19 Jul 2017 18:26:51 +0000 (20:26 +0200)
app/javascript/mastodon/components/status_list.js

index 86e8386bdadc9fba700ebd1e2612b2c3cd4f5e45..a8ea1ec5b1aef41a0b0821339d43c6da591a427a 100644 (file)
@@ -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) {