]> cat aescling's git repositories - mastodon.git/commitdiff
Adjust scroll when statuses above the current scroll position are deleted
authorThibaut Girka <thib@sitedethib.com>
Sat, 9 Feb 2019 21:08:57 +0000 (22:08 +0100)
committerThibG <thib@sitedethib.com>
Sun, 10 Feb 2019 21:54:25 +0000 (22:54 +0100)
app/javascript/flavours/glitch/components/status.js

index 1a5cb4a975fa1ee23c1ef805fede5573944619c8..9d987dc9c310490abcfa614de23318d52eef05e2 100644 (file)
@@ -242,6 +242,15 @@ export default class Status extends ImmutablePureComponent {
     }
   }
 
+  componentWillUnmount() {
+    if (this.node && this.props.getScrollPosition) {
+      const position = this.props.getScrollPosition();
+      if (position !== null && this.node.offsetTop < position.top) {
+         requestAnimationFrame(() => { this.props.updateScrollBottom(position.height - position.top); });
+      }
+    }
+  }
+
   //  `setCollapsed()` sets the value of `isCollapsed` in our state, that is,
   //  whether the toot is collapsed or not.