Skip to content

Commit 9e0b776

Browse files
committed
Ensure we're using nextProps on bindZoomListener when rebinding (#10)
1 parent e2f5576 commit 9e0b776

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/Tree/index.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ export default class Tree extends React.Component {
2323

2424

2525
componentDidMount() {
26-
this.bindZoomListener();
26+
this.bindZoomListener(this.props);
2727
// TODO find better way of setting initialDepth, re-render here is suboptimal
2828
this.setState({ initialRender: false }); // eslint-disable-line
2929
}
@@ -41,7 +41,7 @@ export default class Tree extends React.Component {
4141
if (this.props.translate !== nextProps.translate ||
4242
this.props.scaleExtent !== nextProps.scaleExtent) {
4343
console.log(nextProps.translate, nextProps.scaleExtent);
44-
this.bindZoomListener();
44+
this.bindZoomListener(nextProps);
4545
}
4646
}
4747

@@ -68,8 +68,8 @@ export default class Tree extends React.Component {
6868
*
6969
* @return {void}
7070
*/
71-
bindZoomListener() {
72-
const { zoomable, scaleExtent, translate } = this.props;
71+
bindZoomListener(props) {
72+
const { zoomable, scaleExtent, translate } = props;
7373
const svg = select('.rd3t-svg');
7474
const g = select('.rd3t-g');
7575

0 commit comments

Comments
 (0)