about summary refs log tree commit diff
diff options
context:
space:
mode:
authorunarist <m.unarist@gmail.com>2017-06-20 11:12:51 +0900
committerEugen Rochko <eugen@zeonfederated.com>2017-06-20 04:12:51 +0200
commit94ad0706f514e25c58c0a8f3201f96c1d1ccbbd8 (patch)
tree36feefd1153b039a3ac2909f5a9746780e4cfd2e
parentbf8c2c43483650bc046a3b3dd114f1cdfa49d2b4 (diff)
Don't attach IntersectionObserver for wrapped statuses (#3863)
This fixes a bug that sometimes boosted statuses being hidden on scrolling.

Previously, we've attached IntersectionObserver twice for boosted statuses:
wrapper Status and wrapped Status. This will call intersection handler twice,
so this may results race condition...probably.
-rw-r--r--app/javascript/mastodon/components/status.js5
1 files changed, 4 insertions, 1 deletions
diff --git a/app/javascript/mastodon/components/status.js b/app/javascript/mastodon/components/status.js
index 3b8f88bf7..17f2eb9d3 100644
--- a/app/javascript/mastodon/components/status.js
+++ b/app/javascript/mastodon/components/status.js
@@ -154,7 +154,10 @@ class Status extends ImmutablePureComponent {
   render () {
     let media = null;
     let statusAvatar;
-    const { status, account, ...other } = this.props;
+
+    // Exclude intersectionObserverWrapper from `other` variable
+    // because intersection is managed in here.
+    const { status, account, intersectionObserverWrapper, ...other } = this.props;
     const { isExpanded, isIntersecting, isHidden } = this.state;
 
     if (status === null) {