From 2a5da8c9613b0ef6659edc60831b4fe8e84f3fc8 Mon Sep 17 00:00:00 2001 From: Matt Panaro Date: Tue, 31 Dec 2019 15:39:25 -0500 Subject: [PATCH] refactor IntersectionObserver to observe viewport in single-column mode (#12735) --- app/javascript/mastodon/components/scrollable_list.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/app/javascript/mastodon/components/scrollable_list.js b/app/javascript/mastodon/components/scrollable_list.js index 6338ccd5c50..e4adabb3696 100644 --- a/app/javascript/mastodon/components/scrollable_list.js +++ b/app/javascript/mastodon/components/scrollable_list.js @@ -210,10 +210,13 @@ export default class ScrollableList extends PureComponent { } attachIntersectionObserver () { - this.intersectionObserverWrapper.connect({ + let nodeOptions = { root: this.node, rootMargin: '300% 0px', - }); + }; + + this.intersectionObserverWrapper + .connect(this.props.bindToDocument ? {} : nodeOptions); } detachIntersectionObserver () {