aboutsummaryrefslogtreecommitdiff
path: root/app/javascript/mastodon/components/intersection_observer_article.js
diff options
context:
space:
mode:
authorTakeshi Umeda <noel.yoshiba@gmail.com>2021-01-10 11:17:55 +0900
committerGitHub <noreply@github.com>2021-01-10 11:17:55 +0900
commit98a2603dc163210d3a0aab0a0c2b8ef74c7e5eb0 (patch)
tree761694d2d697c58faf02a3ff9ef26bf045fc0274 /app/javascript/mastodon/components/intersection_observer_article.js
parent7cd4ed7d4298626d2b141cd6d8378e95bc248824 (diff)
parent087ed84367537ac168ed3e00bb7eb4bd582dc3d0 (diff)
downloadmastodon-feature-limited-visibility-bearcaps.tar
mastodon-feature-limited-visibility-bearcaps.tar.gz
mastodon-feature-limited-visibility-bearcaps.tar.bz2
mastodon-feature-limited-visibility-bearcaps.zip
Merge branch 'master' into feature-limited-visibility-bearcapsfeature-limited-visibility-bearcaps
Diffstat (limited to 'app/javascript/mastodon/components/intersection_observer_article.js')
-rw-r--r--app/javascript/mastodon/components/intersection_observer_article.js12
1 files changed, 6 insertions, 6 deletions
diff --git a/app/javascript/mastodon/components/intersection_observer_article.js b/app/javascript/mastodon/components/intersection_observer_article.js
index 124b34b02..2d87f19b5 100644
--- a/app/javascript/mastodon/components/intersection_observer_article.js
+++ b/app/javascript/mastodon/components/intersection_observer_article.js
@@ -2,10 +2,7 @@ import React from 'react';
import PropTypes from 'prop-types';
import scheduleIdleTask from '../features/ui/util/schedule_idle_task';
import getRectFromEntry from '../features/ui/util/get_rect_from_entry';
-import { is } from 'immutable';
-// Diff these props in the "rendered" state
-const updateOnPropsForRendered = ['id', 'index', 'listLength'];
// Diff these props in the "unrendered" state
const updateOnPropsForUnrendered = ['id', 'index', 'listLength', 'cachedHeight'];
@@ -33,9 +30,12 @@ export default class IntersectionObserverArticle extends React.Component {
// If we're going from rendered to unrendered (or vice versa) then update
return true;
}
- // Otherwise, diff based on props
- const propsToDiff = isUnrendered ? updateOnPropsForUnrendered : updateOnPropsForRendered;
- return !propsToDiff.every(prop => is(nextProps[prop], this.props[prop]));
+ // If we are and remain hidden, diff based on props
+ if (isUnrendered) {
+ return !updateOnPropsForUnrendered.every(prop => nextProps[prop] === this.props[prop]);
+ }
+ // Else, assume the children have changed
+ return true;
}
componentDidMount () {