File tree Expand file tree Collapse file tree 1 file changed +8
-9
lines changed
Expand file tree Collapse file tree 1 file changed +8
-9
lines changed Original file line number Diff line number Diff line change @@ -101,26 +101,25 @@ var CaptureClicks = React.createClass({
101101 el . blur ( ) ;
102102 e . preventDefault ( ) ;
103103
104- // flag if we already found a "not found" case and bailed
105- var bail = false ;
104+ // Mark if any of our routers matched. If they didn't, we'll call gotoURL.
105+ var matched = false ;
106106
107107 var onBeforeNavigation = function ( path , navigation , match ) {
108- if ( bail ) {
109- return false ;
110- } else if ( ! match || ! match . match ) {
111- bail = true ;
112- this . props . gotoURL ( el . href ) ;
113- return false ;
108+ if ( match && match . match ) {
109+ matched = true ;
114110 }
115- } . bind ( this ) ;
111+ }
116112
113+ var gotoURL = this . props . gotoURL ;
117114 this . props . environment . navigate (
118115 url . pathname + ( url . hash . length > 1 ? url . hash : '' ) ,
119116 { onBeforeNavigation : onBeforeNavigation } ,
120117 function ( err , info ) {
121118 if ( err ) {
122119 throw err ;
123120 }
121+ // No routers matched - so we'll escape out using gotoURL.
122+ if ( ! matched ) gotoURL ( el . href ) ;
124123 } ) ;
125124 } ,
126125
You can’t perform that action at this time.
0 commit comments