Skip to content

Commit 2000f10

Browse files
committed
Merge branch 'master' into redis
2 parents 72a9e19 + 504ef59 commit 2000f10

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

SSRtest/ModifiedReact.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2212,6 +2212,7 @@ var ReactDOMServerRenderer = function () {
22122212
--- Component caching variables ---
22132213
start: Tracks start index in output string and templatization data for cached components
22142214
saveTemplates: Tracks templatized components so props can be restored in output string
2215+
loadedTemplates: Stores templates that have already been fetched from the cache so that the same template is not fetched several times
22152216
restoreProps: Restores actual props to a templatized component
22162217
getAsync: Convert asynchronous get method into a promise
22172218
*/
@@ -2274,7 +2275,7 @@ var ReactDOMServerRenderer = function () {
22742275
// Generate template placeholders and lookup object for referencing prop names from placeholders
22752276
templatizedProps.forEach((templatizedProp, index) => {
22762277
const placeholder = `{{${index}}}`;
2277-
cacheProps[templatizedProp] = placeholder;
2278+
cacheProps[templatizedProp] = placeholder;
22782279
lookup[placeholder] = templatizedProp; // Move down to next if statement? (Extra work/space if not generating template)
22792280
});
22802281

@@ -2296,7 +2297,7 @@ var ReactDOMServerRenderer = function () {
22962297
let r;
22972298
let restoredTemplate;
22982299

2299-
if (loadedTemplates[cacheKey]) { // Component found in loaded templates
2300+
if (isTemplate && loadedTemplates[cacheKey]) { // Component found in loaded templates
23002301
restoredTemplate = restoreProps(loadedTemplates[cacheKey], realProps, lookup);
23012302
} else {
23022303
const reply = await getAsync(cacheKey);

0 commit comments

Comments
 (0)