Commit 3c96be43 authored by Nicolas Frandeboeuf's avatar Nicolas Frandeboeuf Committed by Benjamin Bouvier
Browse files

Remove window resize listeners in infinite list

parent 89d73c8b
......@@ -49,7 +49,6 @@ class OperationsComponent extends React.Component {
this.computeHeightAbove = this.computeHeightAbove.bind(this);
this.getOperationHeight = this.getOperationHeight.bind(this);
this.getNumItems = this.getNumItems.bind(this);
this.handleWindowResize = this.handleWindowResize.bind(this);
this.operationHeight = computeOperationHeight();
......@@ -87,10 +86,6 @@ class OperationsComponent extends React.Component {
componentDidMount() {
// Called after first render => safe to use findDOMNode.
this.handleWindowResize();
}
handleWindowResize() {
let heightAbove = ReactDOM.findDOMNode(this.operationPanel).offsetTop;
heightAbove += ReactDOM.findDOMNode(this.panelHeading).scrollHeight;
heightAbove += ReactDOM.findDOMNode(this.thead).scrollHeight;
......@@ -237,7 +232,6 @@ class OperationsComponent extends React.Component {
getItemHeight={ this.getOperationHeight }
getHeightAbove={ this.computeHeightAbove }
renderItems={ this.renderItems }
onResizeUser={ this.handleWindowResize }
containerId="content"
/>
</table>
......
......@@ -22,24 +22,15 @@ export default class InfiniteList extends React.Component {
};
this.handleScroll = throttle(this.handleScroll.bind(this), SCROLL_THROTTLING);
this.handleResize = this.handleResize.bind(this);
}
componentDidMount() {
this.container = document.getElementById(this.props.containerId);
this.container.addEventListener('scroll', this.handleScroll);
window.addEventListener('resize', this.handleResize);
}
componentWillUnmount() {
this.container.removeEventListener('scroll', this.handleScroll);
window.removeEventListener('resize', this.handleResize);
}
handleResize(e) {
e.preventDefault();
this.props.onResizeUser();
this.handleScroll();
}
handleScroll(e) {
......@@ -97,9 +88,6 @@ InfiniteList.propTypes = {
// (firstItemShown: Number, lastItemShown: Number) -> [React elements]
renderItems: React.PropTypes.func.isRequired,
// Function called on each window resize.
onResizeUser: React.PropTypes.func,
// The list container html identifier
containerId: React.PropTypes.string.isRequired
};
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment