about summary refs log tree commit diff
path: root/app/javascript
diff options
context:
space:
mode:
authorThibaut Girka <thib@sitedethib.com>2019-02-09 22:08:57 +0100
committerThibG <thib@sitedethib.com>2019-02-10 22:54:25 +0100
commitdfe1d548a58154c988b98cab313496292bdc62e2 (patch)
treeb8013100fdade1bdbd1097b918c65d7025cb9ed7 /app/javascript
parent0b91322762e845acc76966da448eeccd1ad78047 (diff)
Adjust scroll when statuses above the current scroll position are deleted
Diffstat (limited to 'app/javascript')
-rw-r--r--app/javascript/flavours/glitch/components/status.js9
1 files changed, 9 insertions, 0 deletions
diff --git a/app/javascript/flavours/glitch/components/status.js b/app/javascript/flavours/glitch/components/status.js
index 1a5cb4a97..9d987dc9c 100644
--- a/app/javascript/flavours/glitch/components/status.js
+++ b/app/javascript/flavours/glitch/components/status.js
@@ -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.