Skip to content

Commit 392c364

Browse files
author
Sjbeale
authored
Merge pull request #224 from steptools/Speel-Chek
Performance Improvement
2 parents 960ec61 + e2d7ca6 commit 392c364

3 files changed

Lines changed: 19 additions & 10 deletions

File tree

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ Features:
1616

1717
Bugfixes:
1818

19+
- Sidebar now renders only when needed
1920
- Sidebar can now be scrolled in Firefox
2021
- Render radius is properly calculated when workingstep changes
2122
- Bounding boxes update properly with each workingstep

src/client/views/sidebar/workingstepslist/index.jsx

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ export default class WorkingstepList extends React.Component {
99

1010
this.renderNode = this.renderNode.bind(this);
1111
}
12-
12+
1313
getNodeIcon(node, num){
1414
if (node.type == "workplan"){
1515
return <span className='icon-letter'>W</span>;
@@ -18,10 +18,14 @@ export default class WorkingstepList extends React.Component {
1818
}else{
1919
return <span className='icon-letter'>{num+1}</span>;
2020
}
21-
}
22-
21+
}
22+
23+
shouldComponentUpdate(nextProps, nextState) {
24+
return this.props.ws !== nextProps.ws;
25+
}
26+
2327
renderNode(nodeId, num){
24-
28+
2529
let node = this.props.workingstepCache[nodeId];
2630
node.icon = this.getNodeIcon(node, num);
2731
let cName = 'node';
@@ -39,7 +43,7 @@ export default class WorkingstepList extends React.Component {
3943
}
4044

4145
componentDidMount(){
42-
46+
4347
}
4448

4549
render(){
@@ -55,4 +59,4 @@ export default class WorkingstepList extends React.Component {
5559
}
5660
}
5761

58-
WorkingstepList.propTypes = {cbMode: React.PropTypes.func.isRequired, cbTree: React.PropTypes.func.isRequired, ws: React.PropTypes.oneOfType([React.PropTypes.string, React.PropTypes.number]).isRequired};
62+
WorkingstepList.propTypes = {cbMode: React.PropTypes.func.isRequired, cbTree: React.PropTypes.func.isRequired, ws: React.PropTypes.oneOfType([React.PropTypes.string, React.PropTypes.number]).isRequired};

src/client/views/sidebar/workplanlist/index.jsx

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,9 @@ export default class WorkplanList extends React.Component {
2323
if(node.enabled === false)
2424
cName = 'node disabled';
2525
}
26-
26+
2727
node.icon = this.getNodeIcon(node);
28-
28+
2929
return <span
3030
id={node.id}
3131
className={cName}
@@ -36,7 +36,11 @@ export default class WorkplanList extends React.Component {
3636
{node.name}
3737
</span>;
3838
}
39-
39+
40+
shouldComponentUpdate(nextProps, nextState) {
41+
return this.props.ws !== nextProps.ws;
42+
}
43+
4044
getNodeIcon(node){
4145
if (node.type == "workplan"){
4246
return <span className='icon-letter'>W</span>;
@@ -47,7 +51,7 @@ export default class WorkplanList extends React.Component {
4751
}
4852
}
4953
componentDidMount(){
50-
54+
5155
}
5256

5357
render(){

0 commit comments

Comments
 (0)