diff options
author | AlexKlimenkov <shurick.klimenkov@gmail.com> | 2017-05-23 16:45:02 +0300 |
---|---|---|
committer | AlexKlimenkov <shurick.klimenkov@gmail.com> | 2017-05-23 16:45:02 +0300 |
commit | 9c9af54cde48937f7d0ce1ac9f26918af51ada08 (patch) | |
tree | 619ed3b3f854ff4e2df81fb3e671e0cc0af539de /src | |
parent | 83880a83d328e7ea2c73cbace39b38bd479246e8 (diff) | |
download | react-gantt-demo-9c9af54cde48937f7d0ce1ac9f26918af51ada08.zip react-gantt-demo-9c9af54cde48937f7d0ce1ac9f26918af51ada08.tar.gz react-gantt-demo-9c9af54cde48937f7d0ce1ac9f26918af51ada08.tar.bz2 |
use shouldComponentUpdate to check whether gantt should be repainted
Diffstat (limited to 'src')
-rw-r--r-- | src/Gantt.js | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/src/Gantt.js b/src/Gantt.js index 63f672b..7a04bc5 100644 --- a/src/Gantt.js +++ b/src/Gantt.js @@ -39,14 +39,12 @@ export default class Gantt extends Component { } } - componentWillReceiveProps(nextProps){ - this.needGanttRedraw = this.props.zoom !== nextProps.zoom; + shouldComponentUpdate(nextProps ){ + return this.props.zoom !== nextProps.zoom; } componentDidUpdate() { - if (this.needGanttRedraw) { - gantt.render(); - } + gantt.render(); } componentDidMount() { @@ -85,7 +83,7 @@ export default class Gantt extends Component { this.props.onLinkUpdated(id, 'deleted'); } }); - gantt.init(this.ganttContainer); + gantt.init(this.ganttContainer); gantt.parse(this.props.tasks); } |