]> cat aescling's git repositories - mastodon.git/commitdiff
Don't attach IntersectionObserver for wrapped statuses (#3863)
authorunarist <m.unarist@gmail.com>
Tue, 20 Jun 2017 02:12:51 +0000 (11:12 +0900)
committerEugen Rochko <eugen@zeonfederated.com>
Tue, 20 Jun 2017 02:12:51 +0000 (04:12 +0200)
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.

app/javascript/mastodon/components/status.js

index 3b8f88bf791a6b2c49fb90b9100fc0cb1430b1ab..17f2eb9d30fb8dc7378b2848133bfc827ecae47b 100644 (file)
@@ -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) {