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 f4f1a27

Browse files
author
Mejin Leechor
authored
Merge pull request #45 from daviddt/patch-1
Remove static markup from NodeStreamRenderer
2 parents 3ecacab + cf93706 commit f4f1a27

File tree

1 file changed

+4
-13
lines changed

1 file changed

+4
-13
lines changed

‎src/server/ReactDOMNodeStreamRenderer.js‎

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -99,12 +99,7 @@ function originalRenderToNodeStream(element, cache, streamingStart, memLife=0) {
9999
return new ReactMarkupReadableStream(element, false, cache, streamingStart, memLife);
100100
}
101101

102-
export function renderToNodeStream(element, cache, res) {
103-
104-
const htmlStart =
105-
'<html><head><title>Page</title></head><body><div id="react-root">';
106-
107-
const htmlEnd = '</div></body></html>';
102+
export function renderToNodeStream(element, cache, res, htmlStart, htmlEnd, memLife) {
108103

109104
const streamingStart = {
110105
sliceStartCount: htmlStart.length,
@@ -114,7 +109,7 @@ export function renderToNodeStream(element, cache, res) {
114109
cacheStream.pipe(res);
115110
cacheStream.write(htmlStart);
116111

117-
const stream = originalRenderToNodeStream(element, cache, streamingStart);
112+
const stream = originalRenderToNodeStream(element, cache, streamingStart,memLife);
118113
stream.pipe(cacheStream, { end: false });
119114
stream.on("end", () => {
120115
cacheStream.end(htmlEnd);
@@ -131,11 +126,7 @@ function originalRenderToStaticNodeStream(element, cache, streamingStart, memLif
131126
return new ReactMarkupReadableStream(element, true, cache, streamingStart, memLife);
132127
}
133128

134-
export function renderToStaticNodeStream(element, cache, res) {
135-
const htmlStart =
136-
'<html><head><title>Page</title></head><body><div id="react-root">';
137-
138-
const htmlEnd = '</div></body></html>';
129+
export function renderToStaticNodeStream(element, cache, res, htmlStart, htmlEnd, memLife) {
139130

140131
const streamingStart = {
141132
sliceStartCount: htmlStart.length,
@@ -145,7 +136,7 @@ export function renderToStaticNodeStream(element, cache, res) {
145136
cacheStream.pipe(res);
146137
cacheStream.write(htmlStart);
147138

148-
const stream = originalRenderToStaticNodeStream(element, cache, streamingStart);
139+
const stream = originalRenderToStaticNodeStream(element, cache, streamingStart,memLife);
149140
stream.pipe(cacheStream, { end: false });
150141
stream.on("end", () => {
151142
cacheStream.end(htmlEnd);

0 commit comments

Comments
(0)

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