@@ -37,22 +37,6 @@ var LocationContext = {
37
37
} ;
38
38
} ,
39
39
40
- getInitialState : function ( ) {
41
- var location = this . props . location ;
42
-
43
- if ( typeof location === 'string' )
44
- location = NAMED_LOCATIONS [ location ] ;
45
-
46
- // Automatically fall back to full page refreshes in
47
- // browsers that do not support HTML5 history.
48
- if ( location === HistoryLocation && ! supportsHistory ( ) )
49
- location = RefreshLocation ;
50
-
51
- return {
52
- location : location
53
- } ;
54
- } ,
55
-
56
40
componentWillMount : function ( ) {
57
41
var location = this . getLocation ( ) ;
58
42
@@ -63,7 +47,9 @@ var LocationContext = {
63
47
64
48
if ( location ) {
65
49
PathStore . setup ( location ) ;
66
- this . handlePathChange ( ) ;
50
+
51
+ if ( this . updateLocation )
52
+ this . updateLocation ( PathStore . getCurrentPath ( ) , PathStore . getCurrentActionType ( ) ) ;
67
53
}
68
54
} ,
69
55
@@ -86,7 +72,21 @@ var LocationContext = {
86
72
* Returns the location object this component uses.
87
73
*/
88
74
getLocation : function ( ) {
89
- return this . state . location ;
75
+ if ( this . _location == null ) {
76
+ var location = this . props . location ;
77
+
78
+ if ( typeof location === 'string' )
79
+ location = NAMED_LOCATIONS [ location ] ;
80
+
81
+ // Automatically fall back to full page refreshes in
82
+ // browsers that do not support HTML5 history.
83
+ if ( location === HistoryLocation && ! supportsHistory ( ) )
84
+ location = RefreshLocation ;
85
+
86
+ this . _location = location ;
87
+ }
88
+
89
+ return this . _location ;
90
90
} ,
91
91
92
92
childContextTypes : {
0 commit comments