File tree Expand file tree Collapse file tree 1 file changed +6
-9
lines changed Expand file tree Collapse file tree 1 file changed +6
-9
lines changed Original file line number Diff line number Diff line change @@ -16,13 +16,6 @@ var RouterMixin = {
16
16
onNavigation : React . PropTypes . func
17
17
} ,
18
18
19
- getDefaultProps : function ( ) {
20
- return {
21
- onBeforeNavigation : emptyFunction ,
22
- onNavigation : emptyFunction
23
- } ;
24
- } ,
25
-
26
19
childContextTypes : {
27
20
router : React . PropTypes . component
28
21
} ,
@@ -156,13 +149,17 @@ var RouterMixin = {
156
149
* @param {Callback } cb
157
150
*/
158
151
setPath : function ( path , navigation , cb ) {
159
- this . props . onBeforeNavigation ( path , navigation ) ;
152
+ if ( this . props . onBeforeNavigation ) {
153
+ this . props . onBeforeNavigation ( path , navigation ) ;
154
+ }
160
155
this . replaceState ( {
161
156
match : matchRoutes ( this . getRoutes ( this . props ) , path ) ,
162
157
prefix : this . state . prefix ,
163
158
navigation : navigation
164
159
} , function ( ) {
165
- this . props . onNavigation ( ) ;
160
+ if ( this . props . onNavigation ) {
161
+ this . props . onNavigation ( ) ;
162
+ }
166
163
cb ( ) ;
167
164
} . bind ( this ) ) ;
168
165
} ,
You can’t perform that action at this time.
0 commit comments