Assume children of visible IntersectionObserverArticle always change
This fixes multiple issues, while adding few computations
This commit is contained in:
parent
c0b5ee315d
commit
82a76f03a4
|
@ -5,8 +5,6 @@ import scheduleIdleTask from 'flavours/glitch/util/schedule_idle_task';
|
||||||
import getRectFromEntry from 'flavours/glitch/util/get_rect_from_entry';
|
import getRectFromEntry from 'flavours/glitch/util/get_rect_from_entry';
|
||||||
import { is } from 'immutable';
|
import { is } from 'immutable';
|
||||||
|
|
||||||
// Diff these props in the "rendered" state
|
|
||||||
const updateOnPropsForRendered = ['id', 'index', 'listLength'];
|
|
||||||
// Diff these props in the "unrendered" state
|
// Diff these props in the "unrendered" state
|
||||||
const updateOnPropsForUnrendered = ['id', 'index', 'listLength', 'cachedHeight'];
|
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
|
// If we're going from rendered to unrendered (or vice versa) then update
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
// Otherwise, diff based on props
|
// If we are and remain hidden, diff based on props
|
||||||
const propsToDiff = isUnrendered ? updateOnPropsForUnrendered : updateOnPropsForRendered;
|
if (isUnrendered) {
|
||||||
return !propsToDiff.every(prop => is(nextProps[prop], this.props[prop]));
|
return !updateOnPropsForUnrendered.every(prop => is(nextProps[prop], this.props[prop]));
|
||||||
|
}
|
||||||
|
// Else, assume the children have changed
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue