@@ -2235,13 +2235,13 @@ var ReactDOMServerRenderer = function () {
2235
2235
}
2236
2236
2237
2237
// IF THE CHILD HAS A CACHEKEY PROPERTY ON IT
2238
- if ( child . props . cache ) {
2238
+ if ( child . props && child . props . cache ) {
2239
2239
const cacheKey = child . type . name + JSON . stringify ( child . props ) ;
2240
- if ( ! cache . storage . get ( cacheKey ) ) {
2240
+ if ( ! cache . get ( cacheKey ) ) {
2241
2241
start [ cacheKey ] = out . length ;
2242
2242
out += this . render ( child , frame . context , frame . domNamespace ) ;
2243
2243
} else {
2244
- out += cache . storage . get ( cacheKey ) ;
2244
+ out += cache . get ( cacheKey ) ;
2245
2245
}
2246
2246
} else {
2247
2247
out += this . render ( child , frame . context , frame . domNamespace ) ;
@@ -2270,7 +2270,7 @@ var ReactDOMServerRenderer = function () {
2270
2270
} while ( tagStack . length !== 0 ) ;
2271
2271
2272
2272
// cache component by slicing 'out'
2273
- cache . storage . set ( component , out . slice ( start [ component ] , tagEnd ) ) ;
2273
+ cache . set ( component , out . slice ( start [ component ] , tagEnd ) ) ;
2274
2274
}
2275
2275
return out ;
2276
2276
} ;
@@ -2613,9 +2613,16 @@ class ComponentCache {
2613
2613
length : ( n , key ) => {
2614
2614
return n . length + key . length ;
2615
2615
}
2616
- } ) ;
2616
+ } ) ;
2617
+ }
2618
+ get ( cacheKey , cb ) {
2619
+ return this . storage . get ( cacheKey ) ;
2620
+ }
2617
2621
2622
+ set ( cacheKey , html ) {
2623
+ this . storage . set ( cacheKey , html ) ;
2618
2624
}
2625
+
2619
2626
}
2620
2627
2621
2628
// Note: when changing this, also consider https://github.com/facebook/react/issues/11526
0 commit comments