This commit is contained in:
mgabdev
2020-03-03 23:59:11 -05:00
parent 33952e424f
commit 143725b5bd
17 changed files with 34 additions and 176 deletions

View File

@@ -1,4 +1,5 @@
import { is } from 'immutable';
import { setHeight } from '../actions/height_cache';
import scheduleIdleTask from '../utils/schedule_idle_task';
import getRectFromEntry from '../utils/get_rect_from_entry';
@@ -7,7 +8,21 @@ const updateOnPropsForRendered = ['id', 'index', 'listLength'];
// Diff these props in the "unrendered" state
const updateOnPropsForUnrendered = ['id', 'index', 'listLength', 'cachedHeight'];
export default class IntersectionObserverArticle extends Component {
const makeMapStateToProps = (state, props) => ({
cachedHeight: state.getIn(['height_cache', props.saveHeightKey, props.id]),
});
const mapDispatchToProps = (dispatch) => ({
onHeightChange (key, id, height) {
dispatch(setHeight(key, id, height));
},
});
export default
@connect(makeMapStateToProps, mapDispatchToProps)
class IntersectionObserverArticle extends Component {
static propTypes = {
intersectionObserverWrapper: PropTypes.object.isRequired,