Skip to content

Commit 976fc5a

Browse files
committed
Including pure render decorator
1 parent 310e076 commit 976fc5a

File tree

11 files changed

+48
-14
lines changed

11 files changed

+48
-14
lines changed

client/app/bundles/comments/components/CommentBox/CommentBox.jsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
11
import React, { PropTypes } from 'react';
2+
import pureRender from 'pure-render-decorator';
23

34
import CommentForm from './CommentForm/CommentForm';
45
import CommentList from './CommentList/CommentList';
5-
66
import css from './CommentBox.scss';
77

88
export default class CommentBox extends React.Component {
9-
109
static propTypes = {
1110
pollInterval: PropTypes.number.isRequired,
1211
actions: PropTypes.object.isRequired,

client/app/bundles/comments/components/CommentBox/CommentForm/CommentForm.jsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import React, { PropTypes } from 'react';
2+
import ReactDOM from 'react-dom';
23
import Input from 'react-bootstrap/lib/Input';
34
import Row from 'react-bootstrap/lib/Row';
45
import Col from 'react-bootstrap/lib/Col';
@@ -7,12 +8,12 @@ import NavItem from 'react-bootstrap/lib/NavItem';
78
import Alert from 'react-bootstrap/lib/Alert';
89
import ReactCSSTransitionGroup from 'react/lib/ReactCSSTransitionGroup';
910
import _ from 'lodash';
11+
import pureRender from 'pure-render-decorator';
1012

1113
const emptyComment = { author: '', text: '' };
1214
const textPlaceholder = 'Say something using markdown...';
1315

1416
export default class CommentForm extends React.Component {
15-
1617
static propTypes = {
1718
isSaving: PropTypes.bool.isRequired,
1819
actions: PropTypes.object.isRequired,
@@ -78,7 +79,7 @@ export default class CommentForm extends React.Component {
7879
if (this.state.formMode < 2) {
7980
ref = this.refs.text.getInputDOMNode();
8081
} else {
81-
ref = React.findDOMNode(this.refs.inlineText);
82+
ref = ReactDOM.findDOMNode(this.refs.inlineText);
8283
}
8384

8485
ref.focus();

client/app/bundles/comments/components/CommentBox/CommentList/Comment/Comment.jsx

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,17 @@
11
import React, { PropTypes } from 'react';
22
import marked from 'marked';
3+
import pureRender from 'pure-render-decorator';
34

5+
<<<<<<< HEAD:client/app/bundles/comments/components/CommentBox/CommentList/Comment/Comment.jsx
46
import css from './Comment.scss';
57

68
export default class Comment extends React.Component {
79

10+
=======
11+
@pureRender
12+
class Comment extends React.Component {
13+
static displayName = 'Comment';
14+
>>>>>>> Including pure render decorator:client/app/bundles/Comments/components/Comment.jsx
815
static propTypes = {
916
author: PropTypes.string.isRequired,
1017
text: PropTypes.string.isRequired,

client/app/bundles/comments/components/CommentBox/CommentList/CommentList.jsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ import _ from 'lodash';
77
import Comment from './Comment/Comment';
88

99
export default class CommentList extends React.Component {
10-
1110
static propTypes = {
1211
$$comments: PropTypes.instanceOf(Immutable.List).isRequired,
1312
error: PropTypes.any,

client/app/bundles/comments/components/SimpleCommentScreen/SimpleCommentScreen.jsx

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,11 @@ import CommentForm from '../CommentBox/CommentForm/CommentForm';
88
import CommentList from '../CommentBox/CommentList/CommentList';
99

1010
export default class SimpleCommentScreen extends React.Component {
11-
1211
constructor(props, context) {
1312
super(props, context);
1413
this.state = {
1514
$$comments: Immutable.fromJS([]),
16-
ajaxSending: false,
15+
isSaving: false,
1716
fetchCommentsError: null,
1817
submitCommentError: null,
1918
};
@@ -35,7 +34,7 @@ export default class SimpleCommentScreen extends React.Component {
3534
}
3635

3736
_handleCommentSubmit(comment) {
38-
this.setState({ ajaxSending: true });
37+
this.setState({ isSaving: true });
3938

4039
const requestConfig = {
4140
responseType: 'json',
@@ -53,13 +52,13 @@ export default class SimpleCommentScreen extends React.Component {
5352

5453
this.setState({
5554
$$comments: $$comments.push($$comment),
56-
ajaxSending: false,
55+
isSaving: false,
5756
});
5857
})
5958
.catch(error => {
6059
this.setState({
6160
submitCommentError: error,
62-
ajaxSending: false,
61+
isSaving: false,
6362
});
6463
})
6564
);
@@ -74,7 +73,7 @@ export default class SimpleCommentScreen extends React.Component {
7473
<b>Name</b> is preserved. <b>Text</b> is reset, between submits.
7574
</p>
7675
<CommentForm
77-
ajaxSending={this.state.ajaxSending}
76+
isSaving={this.state.isSaving}
7877
actions={{ submitComment: this._handleCommentSubmit }}
7978
error={this.state.submitCommentError}
8079
/>

client/app/bundles/comments/components/TestReactRouter/TestReactRouter.jsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
import React from 'react';
2+
import pureRender from 'pure-render-decorator';
23

4+
@pureRender
35
export default class TestReactRouter extends React.Component {
46

57
render() {

client/app/bundles/comments/components/TestReactRouterRedirect/TestReactRouterRedirect.jsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
import React from 'react';
2+
import pureRender from 'pure-render-decorator';
23

4+
@pureRender
35
export default class TestReactRouterRedirect extends React.Component {
46

57
static checkAuth(nextState, replaceState) {

client/app/bundles/comments/containers/NonRouterCommentsContainer.jsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
import React, { PropTypes } from 'react';
2-
import CommentScreen from '../components/CommentScreen/CommentScreen';
32
import { connect } from 'react-redux';
43
import { bindActionCreators } from 'redux';
4+
import pureRender from 'pure-render-decorator';
5+
6+
import CommentScreen from '../components/CommentScreen/CommentScreen';
57
import * as commentsActionCreators from '../actions/commentsActionCreators';
68

79
function select(state) {

client/app/bundles/comments/containers/RouterCommentsContainer.jsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
import React, { PropTypes } from 'react';
2-
import CommentScreen from '../components/CommentScreen/CommentScreen';
32
import { connect } from 'react-redux';
43
import { bindActionCreators } from 'redux';
4+
import pureRender from 'pure-render-decorator';
5+
6+
import CommentScreen from '../components/CommentScreen/CommentScreen';
57
import * as commentsActionCreators from '../actions/commentsActionCreators';
68

79
function select(state) {
@@ -10,7 +12,6 @@ function select(state) {
1012
}
1113

1214
class RouterCommentsContainer extends React.Component {
13-
1415
static propTypes = {
1516
dispatch: PropTypes.func.isRequired,
1617
data: PropTypes.object.isRequired,

client/npm-shrinkwrap.json

Lines changed: 21 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

client/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@
6767
"node-uuid": "^1.4.7",
6868
"postcss-loader": "^0.8.0",
6969
"react": "^0.14.3",
70+
"react-addons-shallow-compare": "^0.14.3",
7071
"react-bootstrap": "^0.28.1",
7172
"react-dom": "^0.14.3",
7273
"react-redux": "^4.0.0",

0 commit comments

Comments
 (0)