File tree Expand file tree Collapse file tree 11 files changed +49
-22
lines changed Expand file tree Collapse file tree 11 files changed +49
-22
lines changed Original file line number Diff line number Diff line change 1
1
import React , { PropTypes } from 'react' ;
2
2
import marked from 'marked' ;
3
- import pureRender from 'pure-render-decorator ' ;
3
+ import PureRenderMixin from 'react-addons- pure-render-mixin ' ;
4
4
5
- @pureRender
6
5
class Comment extends React . Component {
7
6
static displayName = 'Comment' ;
8
7
static propTypes = {
9
8
author : PropTypes . string . isRequired ,
10
9
text : PropTypes . string . isRequired ,
11
10
} ;
12
11
12
+ shouldComponentUpdate ( ) {
13
+ return PureRenderMixin . shouldComponentUpdate . apply ( this , arguments ) ;
14
+ }
15
+
13
16
render ( ) {
14
17
const { author, text } = this . props ;
15
18
const rawMarkup = marked ( text , { gfm : true , sanitize : true } ) ;
Original file line number Diff line number Diff line change 1
1
import React , { PropTypes } from 'react' ;
2
- import pureRender from 'pure-render-decorator ' ;
2
+ import PureRenderMixin from 'react-addons- pure-render-mixin ' ;
3
3
4
4
import CommentForm from './CommentForm' ;
5
5
import CommentList from './CommentList' ;
6
6
7
- @pureRender
8
7
class CommentBox extends React . Component {
9
8
constructor ( props , context ) {
10
9
super ( props , context ) ;
@@ -18,6 +17,10 @@ class CommentBox extends React.Component {
18
17
data : PropTypes . object . isRequired ,
19
18
} ;
20
19
20
+ shouldComponentUpdate ( ) {
21
+ return PureRenderMixin . shouldComponentUpdate . apply ( this , arguments ) ;
22
+ }
23
+
21
24
componentDidMount ( ) {
22
25
const { fetchComments } = this . props . actions ;
23
26
fetchComments ( ) ;
Original file line number Diff line number Diff line change @@ -8,12 +8,11 @@ import NavItem from 'react-bootstrap/lib/NavItem';
8
8
import Alert from 'react-bootstrap/lib/Alert' ;
9
9
import ReactCSSTransitionGroup from 'react/lib/ReactCSSTransitionGroup' ;
10
10
import _ from 'lodash' ;
11
- import pureRender from 'pure-render-decorator ' ;
11
+ import PureRenderMixin from 'react-addons- pure-render-mixin ' ;
12
12
13
13
const emptyComment = { author : '' , text : '' } ;
14
14
const textPlaceholder = 'Say something using markdown...' ;
15
15
16
- @pureRender
17
16
class CommentForm extends React . Component {
18
17
constructor ( props , context ) {
19
18
super ( props , context ) ;
@@ -33,6 +32,10 @@ class CommentForm extends React.Component {
33
32
error : PropTypes . any ,
34
33
} ;
35
34
35
+ shouldComponentUpdate ( ) {
36
+ return PureRenderMixin . shouldComponentUpdate . apply ( this , arguments ) ;
37
+ }
38
+
36
39
_handleSelect ( selectedKey ) {
37
40
this . setState ( { formMode : selectedKey } ) ;
38
41
}
Original file line number Diff line number Diff line change @@ -2,11 +2,10 @@ import React, { PropTypes } from 'react';
2
2
import Immutable from 'immutable' ;
3
3
import Alert from 'react-bootstrap/lib/Alert' ;
4
4
import ReactCSSTransitionGroup from 'react/lib/ReactCSSTransitionGroup' ;
5
- import pureRender from 'pure-render-decorator ' ;
5
+ import PureRenderMixin from 'react-addons- pure-render-mixin ' ;
6
6
7
7
import Comment from './Comment' ;
8
8
9
- @pureRender
10
9
class CommentList extends React . Component {
11
10
12
11
constructor ( props , context ) {
@@ -23,6 +22,10 @@ class CommentList extends React.Component {
23
22
error : PropTypes . any ,
24
23
} ;
25
24
25
+ shouldComponentUpdate ( ) {
26
+ return PureRenderMixin . shouldComponentUpdate . apply ( this , arguments ) ;
27
+ }
28
+
26
29
_errorWarning ( ) {
27
30
// If there is no error, there is nothing to add to the DOM
28
31
if ( ! this . props . error ) return undefined ;
Original file line number Diff line number Diff line change 1
1
import React , { PropTypes } from 'react' ;
2
- import pureRender from 'pure-render-decorator ' ;
2
+ import PureRenderMixin from 'react-addons- pure-render-mixin ' ;
3
3
4
4
import CommentBox from './CommentBox' ;
5
5
6
- @pureRender
7
6
class CommentScreen extends React . Component {
8
7
static propTypes = {
9
8
actions : PropTypes . object . isRequired ,
10
9
data : PropTypes . object . isRequired ,
11
10
} ;
12
11
12
+ shouldComponentUpdate ( ) {
13
+ return PureRenderMixin . shouldComponentUpdate . apply ( this , arguments ) ;
14
+ }
15
+
13
16
render ( ) {
14
17
const { data, actions } = this . props ;
15
18
Original file line number Diff line number Diff line change 1
1
import React , { PropTypes } from 'react' ;
2
2
import { connect } from 'react-redux' ;
3
3
import { bindActionCreators } from 'redux' ;
4
- import pureRender from 'pure-render-decorator ' ;
4
+ import PureRenderMixin from 'react-addons- pure-render-mixin ' ;
5
5
6
6
import CommentScreen from './CommentScreen' ;
7
7
import * as commentsActionCreators from '../actions/commentsActionCreators' ;
@@ -11,13 +11,16 @@ function select(state) {
11
11
return { data : state . $$commentsStore } ;
12
12
}
13
13
14
- @pureRender
15
14
class NonRouterCommentScreen extends React . Component {
16
15
static propTypes = {
17
16
dispatch : PropTypes . func . isRequired ,
18
17
data : PropTypes . object . isRequired ,
19
18
} ;
20
19
20
+ shouldComponentUpdate ( ) {
21
+ return PureRenderMixin . shouldComponentUpdate . apply ( this , arguments ) ;
22
+ }
23
+
21
24
render ( ) {
22
25
const { dispatch, data } = this . props ;
23
26
const actions = bindActionCreators ( commentsActionCreators , dispatch ) ;
Original file line number Diff line number Diff line change 1
1
import React , { PropTypes } from 'react' ;
2
2
import { connect } from 'react-redux' ;
3
3
import { bindActionCreators } from 'redux' ;
4
- import pureRender from 'pure-render-decorator ' ;
4
+ import PureRenderMixin from 'react-addons- pure-render-mixin ' ;
5
5
6
6
import CommentScreen from './CommentScreen' ;
7
7
import * as commentsActionCreators from '../actions/commentsActionCreators' ;
@@ -11,7 +11,6 @@ function select(state) {
11
11
return { data : state . $$commentsStore } ;
12
12
}
13
13
14
- @pureRender
15
14
class RouterCommentScreen extends React . Component {
16
15
static propTypes = {
17
16
dispatch : PropTypes . func . isRequired ,
@@ -21,6 +20,10 @@ class RouterCommentScreen extends React.Component {
21
20
} ) . isRequired ,
22
21
} ;
23
22
23
+ shouldComponentUpdate ( ) {
24
+ return PureRenderMixin . shouldComponentUpdate . apply ( this , arguments ) ;
25
+ }
26
+
24
27
_renderNotification ( ) {
25
28
const locationState = this . props . location . state ;
26
29
if ( ! locationState || ! locationState . redirectFrom ) return null ;
Original file line number Diff line number Diff line change @@ -2,13 +2,12 @@ import React from 'react';
2
2
import Immutable from 'immutable' ;
3
3
import request from 'axios' ;
4
4
import _ from 'lodash' ;
5
- import pureRender from 'pure-render-decorator ' ;
5
+ import PureRenderMixin from 'react-addons- pure-render-mixin ' ;
6
6
7
7
import CommentForm from './CommentForm' ;
8
8
import CommentList from './CommentList' ;
9
9
import metaTagsManager from '../utils/metaTagsManager' ;
10
10
11
- @pureRender
12
11
class SimpleCommentScreen extends React . Component {
13
12
constructor ( props , context ) {
14
13
super ( props , context ) ;
@@ -24,6 +23,10 @@ class SimpleCommentScreen extends React.Component {
24
23
25
24
static displayName = 'SimpleCommentScreen' ;
26
25
26
+ shouldComponentUpdate ( ) {
27
+ return PureRenderMixin . shouldComponentUpdate . apply ( this , arguments ) ;
28
+ }
29
+
27
30
componentDidMount ( ) {
28
31
this . _fetchComments ( ) ;
29
32
}
Original file line number Diff line number Diff line change 1
1
import React from 'react' ;
2
- import pureRender from 'pure-render-decorator ' ;
2
+ import PureRenderMixin from 'react-addons- pure-render-mixin ' ;
3
3
4
- @pureRender
5
4
export default class TestReactRouter extends React . Component {
5
+ shouldComponentUpdate ( ) {
6
+ return PureRenderMixin . shouldComponentUpdate . apply ( this , arguments ) ;
7
+ }
6
8
7
9
render ( ) {
8
10
return (
Original file line number Diff line number Diff line change 1
1
import React from 'react' ;
2
- import pureRender from 'pure-render-decorator ' ;
2
+ import PureRenderMixin from 'react-addons- pure-render-mixin ' ;
3
3
4
- @pureRender
5
4
export default class TestReactRouterRedirect extends React . Component {
5
+ shouldComponentUpdate ( ) {
6
+ return PureRenderMixin . shouldComponentUpdate . apply ( this , arguments ) ;
7
+ }
6
8
7
9
static checkAuth ( nextState , replaceState ) {
8
10
// Hard code this to demonstrate the effect
Original file line number Diff line number Diff line change 52
52
"lodash" : " ^3.10.1" ,
53
53
"marked" : " ^0.3.5" ,
54
54
"node-uuid" : " ^1.4.7" ,
55
- "pure-render-decorator" : " ^0.2.0" ,
56
55
"react" : " ^0.14.3" ,
57
- "react-addons-shallow-compare " : " ^0.14.3" ,
56
+ "react-addons-pure-render-mixin " : " ^0.14.3" ,
58
57
"react-bootstrap" : " ^0.28.1" ,
59
58
"react-dom" : " ^0.14.3" ,
60
59
"react-redux" : " ^4.0.0" ,
You can’t perform that action at this time.
0 commit comments