diff options
author | Thibaut Girka <thib@sitedethib.com> | 2019-06-30 18:05:37 +0200 |
---|---|---|
committer | ThibG <thib@sitedethib.com> | 2019-07-01 19:31:10 +0200 |
commit | 82a76f03a4e503d76c29570cd97f6e135ef3d7a7 (patch) | |
tree | 2ccafc3e84fb671add150b26eef7e4cd84243b19 /app/javascript/flavours | |
parent | c0b5ee315dcf6ae5d716eaf5756348ef096397ef (diff) |
Assume children of visible IntersectionObserverArticle always change
This fixes multiple issues, while adding few computations
Diffstat (limited to 'app/javascript/flavours')
-rw-r--r-- | app/javascript/flavours/glitch/components/intersection_observer_article.js | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/app/javascript/flavours/glitch/components/intersection_observer_article.js b/app/javascript/flavours/glitch/components/intersection_observer_article.js index 2a99a2620..c8427f0bf 100644 --- a/app/javascript/flavours/glitch/components/intersection_observer_article.js +++ b/app/javascript/flavours/glitch/components/intersection_observer_article.js @@ -5,8 +5,6 @@ import scheduleIdleTask from 'flavours/glitch/util/schedule_idle_task'; import getRectFromEntry from 'flavours/glitch/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']; @@ -34,9 +32,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 => is(nextProps[prop], this.props[prop])); + } + // Else, assume the children have changed + return true; } |