]> cat aescling's git repositories - mastodon.git/commitdiff
Hide items rendered out-of-frame (once they have been rendered at least once)
authorThibaut Girka <thib@sitedethib.com>
Wed, 6 Feb 2019 17:59:28 +0000 (18:59 +0100)
committerThibG <thib@sitedethib.com>
Sun, 10 Feb 2019 21:54:25 +0000 (22:54 +0100)
app/javascript/flavours/glitch/components/intersection_observer_article.js

index 6eeca5598e391b0fd1e11504c8f6c84cbac541a7..03d8f17c6b207c029c9bc698760240cea1de00e0 100644 (file)
@@ -63,7 +63,7 @@ export default class IntersectionObserverArticle extends ImmutablePureComponent
   }
 
   updateStateAfterIntersection = (prevState) => {
-    if (prevState.isIntersecting && !this.entry.isIntersecting) {
+    if (prevState.isIntersecting !== false && !this.entry.isIntersecting) {
       scheduleIdleTask(this.hideIfNotIntersecting);
     }
     return {
@@ -109,7 +109,7 @@ export default class IntersectionObserverArticle extends ImmutablePureComponent
           ref={this.handleRef}
           aria-posinset={index + 1}
           aria-setsize={listLength}
-          style={{ height: `${this.height || cachedHeight}px`, opacity: 0, overflow: 'hidden' }}
+          style={{ height: `${this.height || cachedHeight || 150}px`, opacity: 0, overflow: 'hidden' }}
           data-id={id}
           tabIndex='0'
         >