File tree 2 files changed +7
-3
lines changed
2 files changed +7
-3
lines changed Original file line number Diff line number Diff line change @@ -5,6 +5,7 @@ var invariant = require('./util/invariant');
5
5
var assign = Object . assign || require ( 'object-assign' ) ;
6
6
var matchRoutes = require ( './matchRoutes' ) ;
7
7
var Environment = require ( './environment' ) ;
8
+ var shallowEqual = require ( 'is-equal-shallow' ) ;
8
9
9
10
var RouterMixin = {
10
11
mixins : [ Environment . Mixin ] ,
@@ -39,8 +40,10 @@ var RouterMixin = {
39
40
} ,
40
41
41
42
componentWillReceiveProps : function ( nextProps ) {
42
- var nextState = this . getRouterState ( nextProps ) ;
43
- this . delegateSetRoutingState ( nextState ) ;
43
+ if ( ! shallowEqual ( nextProps , this . props ) ) {
44
+ var nextState = this . getRouterState ( nextProps ) ;
45
+ this . delegateSetRoutingState ( nextState ) ;
46
+ }
44
47
} ,
45
48
46
49
getRouterState : function ( props ) {
Original file line number Diff line number Diff line change 4
4
"description" : " Declarative router component for React" ,
5
5
"main" : " index.js" ,
6
6
"dependencies" : {
7
+ "is-equal-shallow" : " ^0.1.3" ,
7
8
"object-assign" : " ^4.1.0" ,
8
9
"object.omit" : " ^2.0.0" ,
9
10
"qs" : " ^6.2.0" ,
70
71
"publishConfig" : {
71
72
"registry" : " https://registry.npmjs.org"
72
73
}
73
- }
74
+ }
You can’t perform that action at this time.
0 commit comments