Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 504ef59

Browse files
Merge pull request #27 from adifiore/master
check for template
2 parents 085f964 + 795d29c commit 504ef59

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
@@ -2209,6 +2209,7 @@ var ReactDOMServerRenderer = function () {
22092209
--- Component caching variables ---
22102210
start: Tracks start index in output string and templatization data for cached components
22112211
saveTemplates: Tracks templatized components so props can be restored in output string
2212+
loadedTemplates: Stores templates that have already been fetched from the cache so that the same template is not fetched several times
22122213
restoreProps: Restores actual props to a templatized component
22132214
*/
22142215
const start = {};
@@ -2270,7 +2271,7 @@ var ReactDOMServerRenderer = function () {
22702271
// Generate template placeholders and lookup object for referencing prop names from placeholders
22712272
templatizedProps.forEach((templatizedProp, index) => {
22722273
const placeholder = `{{${index}}}`;
2273-
cacheProps[templatizedProp] = placeholder;
2274+
cacheProps[templatizedProp] = placeholder;
22742275
lookup[placeholder] = templatizedProp; // Move down to next if statement? (Extra work/space if not generating template)
22752276
});
22762277

@@ -2290,7 +2291,7 @@ var ReactDOMServerRenderer = function () {
22902291
let r;
22912292
let restoredTemplate;
22922293

2293-
if (loadedTemplates[cacheKey]) { // Component found in loaded templates
2294+
if (isTemplate&&loadedTemplates[cacheKey]) { // Component found in loaded templates
22942295
restoredTemplate = restoreProps(loadedTemplates[cacheKey], realProps, lookup);
22952296
} else {
22962297
let reply = cache.get(cacheKey);

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /