Skip to content

Commit a77acd2

Browse files
acdlitegnoff
andauthoredOct 23, 2023
Update React from d803f519e to b8e47d988 (#57296)
React upstream changes: - facebook/react#27570 - facebook/react#27569 - facebook/react#27550 - facebook/react#27559 - facebook/react#27552 - facebook/react#27504 - facebook/react#27522 Co-authored-by: Josh Story <[email protected]>
1 parent 8fb5c85 commit a77acd2

File tree

48 files changed

+3283
-2931
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+3283
-2931
lines changed
 

‎package.json

+10-10
Original file line numberDiff line numberDiff line change
@@ -193,16 +193,16 @@
193193
"random-seed": "0.3.0",
194194
"react": "18.2.0",
195195
"react-17": "npm:react@17.0.2",
196-
"react-builtin": "npm:react@18.3.0-canary-d803f519e-20231020",
196+
"react-builtin": "npm:react@18.3.0-canary-b8e47d988-20231023",
197197
"react-dom": "18.2.0",
198198
"react-dom-17": "npm:react-dom@17.0.2",
199-
"react-dom-builtin": "npm:react-dom@18.3.0-canary-d803f519e-20231020",
200-
"react-dom-experimental-builtin": "npm:react-dom@0.0.0-experimental-d803f519e-20231020",
201-
"react-experimental-builtin": "npm:react@0.0.0-experimental-d803f519e-20231020",
202-
"react-server-dom-turbopack": "18.3.0-canary-d803f519e-20231020",
203-
"react-server-dom-turbopack-experimental": "npm:react-server-dom-turbopack@0.0.0-experimental-d803f519e-20231020",
204-
"react-server-dom-webpack": "18.3.0-canary-d803f519e-20231020",
205-
"react-server-dom-webpack-experimental": "npm:react-server-dom-webpack@0.0.0-experimental-d803f519e-20231020",
199+
"react-dom-builtin": "npm:react-dom@18.3.0-canary-b8e47d988-20231023",
200+
"react-dom-experimental-builtin": "npm:react-dom@0.0.0-experimental-b8e47d988-20231023",
201+
"react-experimental-builtin": "npm:react@0.0.0-experimental-b8e47d988-20231023",
202+
"react-server-dom-turbopack": "18.3.0-canary-b8e47d988-20231023",
203+
"react-server-dom-turbopack-experimental": "npm:react-server-dom-turbopack@0.0.0-experimental-b8e47d988-20231023",
204+
"react-server-dom-webpack": "18.3.0-canary-b8e47d988-20231023",
205+
"react-server-dom-webpack-experimental": "npm:react-server-dom-webpack@0.0.0-experimental-b8e47d988-20231023",
206206
"react-ssr-prepass": "1.0.8",
207207
"react-virtualized": "9.22.3",
208208
"relay-compiler": "13.0.2",
@@ -212,8 +212,8 @@
212212
"resolve-from": "5.0.0",
213213
"sass": "1.54.0",
214214
"satori": "0.10.6",
215-
"scheduler-builtin": "npm:scheduler@0.24.0-canary-d803f519e-20231020",
216-
"scheduler-experimental-builtin": "npm:scheduler@0.0.0-experimental-d803f519e-20231020",
215+
"scheduler-builtin": "npm:scheduler@0.24.0-canary-b8e47d988-20231023",
216+
"scheduler-experimental-builtin": "npm:scheduler@0.0.0-experimental-b8e47d988-20231023",
217217
"seedrandom": "3.0.5",
218218
"selenium-webdriver": "4.0.0-beta.4",
219219
"semver": "7.3.7",

‎packages/next/src/compiled/react-dom-experimental/cjs/react-dom-server-legacy.browser.development.js

+52-33
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ if (process.env.NODE_ENV !== "production") {
1717
var React = require("next/dist/compiled/react-experimental");
1818
var ReactDOM = require('react-dom');
1919

20-
var ReactVersion = '18.3.0-experimental-d803f519e-20231020';
20+
var ReactVersion = '18.3.0-experimental-b8e47d988-20231023';
2121

2222
var ReactSharedInternals = React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
2323

@@ -1909,7 +1909,7 @@ function createResumableState(identifierPrefix, externalRuntimeConfig) {
19091909
moduleUnknownResources: {},
19101910
moduleScriptResources: {}
19111911
};
1912-
} // Constants for the insertion mode we're currently writing in. We don't encode all HTML5 insertion
1912+
}
19131913
// modes. We only include the variants as they matter for the sake of our purposes.
19141914
// We don't actually provide the namespace therefore we use constants instead of the string.
19151915

@@ -3538,7 +3538,7 @@ function pushStyleImpl(target, props) {
35383538
}
35393539

35403540
pushInnerHTML(target, innerHTML, children);
3541-
target.push(endTag1, stringToChunk('style'), endTag2);
3541+
target.push(endChunkForTag('style'));
35423542
return null;
35433543
}
35443544

@@ -3760,7 +3760,7 @@ function pushTitleImpl(target, props) {
37603760
}
37613761

37623762
pushInnerHTML(target, innerHTML, children);
3763-
target.push(endTag1, stringToChunk('title'), endTag2);
3763+
target.push(endChunkForTag('title'));
37643764
return null;
37653765
}
37663766

@@ -3903,7 +3903,7 @@ function pushScriptImpl(target, props) {
39033903
target.push(stringToChunk(encodeHTMLTextNode(children)));
39043904
}
39053905

3906-
target.push(endTag1, stringToChunk('script'), endTag2);
3906+
target.push(endChunkForTag('script'));
39073907
return null;
39083908
}
39093909

@@ -4241,8 +4241,19 @@ function pushStartInstance(target, type, props, resumableState, renderState, for
42414241

42424242
return pushStartGenericElement(target, props, type);
42434243
}
4244-
var endTag1 = stringToPrecomputedChunk('</');
4245-
var endTag2 = stringToPrecomputedChunk('>');
4244+
var endTagCache = new Map();
4245+
4246+
function endChunkForTag(tag) {
4247+
var chunk = endTagCache.get(tag);
4248+
4249+
if (chunk === undefined) {
4250+
chunk = stringToPrecomputedChunk('</' + tag + '>');
4251+
endTagCache.set(tag, chunk);
4252+
}
4253+
4254+
return chunk;
4255+
}
4256+
42464257
function pushEndInstance(target, type, props, resumableState, formatContext) {
42474258
switch (type) {
42484259
// When float is on we expect title and script tags to always be pushed in
@@ -4299,7 +4310,7 @@ function pushEndInstance(target, type, props, resumableState, formatContext) {
42994310
break;
43004311
}
43014312

4302-
target.push(endTag1, stringToChunk(type), endTag2);
4313+
target.push(endChunkForTag(type));
43034314
}
43044315

43054316
function writeBootstrap(destination, renderState) {
@@ -5088,9 +5099,7 @@ function writePreamble(destination, resumableState, renderState, willFlushAllSeg
50885099
// if the main content contained the </head> it would also have provided a
50895100
// <head>. This means that all the content inside <html> is either <body> or
50905101
// invalid HTML
5091-
writeChunk(destination, endTag1);
5092-
writeChunk(destination, stringToChunk('head'));
5093-
writeChunk(destination, endTag2);
5102+
writeChunk(destination, endChunkForTag('head'));
50945103
}
50955104
} // We don't bother reporting backpressure at the moment because we expect to
50965105
// flush the entire preamble in a single pass. This probably should be modified
@@ -5147,15 +5156,11 @@ function writeHoistables(destination, resumableState, renderState) {
51475156
}
51485157
function writePostamble(destination, resumableState) {
51495158
if (resumableState.hasBody) {
5150-
writeChunk(destination, endTag1);
5151-
writeChunk(destination, stringToChunk('body'));
5152-
writeChunk(destination, endTag2);
5159+
writeChunk(destination, endChunkForTag('body'));
51535160
}
51545161

51555162
if (resumableState.hasHtml) {
5156-
writeChunk(destination, endTag1);
5157-
writeChunk(destination, stringToChunk('html'));
5158-
writeChunk(destination, endTag2);
5163+
writeChunk(destination, endChunkForTag('html'));
51595164
}
51605165
}
51615166
var arrayFirstOpenBracket = stringToPrecomputedChunk('[');
@@ -9997,6 +10002,18 @@ function trackPostpone(request, trackedPostpones, task, segment) {
999710002
var keyPath = task.keyPath;
999810003
var boundary = task.blockedBoundary;
999910004

10005+
if (boundary === null) {
10006+
segment.id = request.nextSegmentId++;
10007+
trackedPostpones.rootSlots = segment.id;
10008+
10009+
if (request.completedRootSegment !== null) {
10010+
// Postpone the root if this was a deeper segment.
10011+
request.completedRootSegment.status = POSTPONED;
10012+
}
10013+
10014+
return;
10015+
}
10016+
1000010017
if (boundary !== null && boundary.status === PENDING) {
1000110018
boundary.status = POSTPONED; // We need to eagerly assign it an ID because we'll need to refer to
1000210019
// it before flushing and we know that we can't inline it.
@@ -10260,7 +10277,7 @@ function renderNode(request, task, node, childIndex) {
1026010277
return;
1026110278
}
1026210279

10263-
if (request.trackedPostpones !== null && x.$$typeof === REACT_POSTPONE_TYPE && task.blockedBoundary !== null // TODO: Support holes in the shell
10280+
if (request.trackedPostpones !== null && x.$$typeof === REACT_POSTPONE_TYPE && task.blockedBoundary !== null // bubble if we're postponing in the shell
1026410281
) {
1026510282
// If we're tracking postpones, we inject a hole here and continue rendering
1026610283
// sibling. Similar to suspending. If we're not tracking, we treat it more like
@@ -10731,20 +10748,19 @@ function retryRenderTask(request, task, segment) {
1073110748
x.then(ping, ping);
1073210749
task.thenableState = getThenableStateAfterSuspending();
1073310750
return;
10734-
} else if (request.trackedPostpones !== null && x.$$typeof === REACT_POSTPONE_TYPE && task.blockedBoundary !== null // TODO: Support holes in the shell
10735-
) {
10736-
// If we're tracking postpones, we mark this segment as postponed and finish
10737-
// the task without filling it in. If we're not tracking, we treat it more like
10738-
// an error.
10739-
var trackedPostpones = request.trackedPostpones;
10740-
task.abortSet.delete(task);
10741-
var postponeInstance = x;
10742-
logPostpone(request, postponeInstance.message);
10743-
trackPostpone(request, trackedPostpones, task, segment);
10744-
finishedTask(request, task.blockedBoundary, segment);
10745-
lastBoundaryErrorComponentStackDev = null;
10746-
return;
10747-
}
10751+
} else if (request.trackedPostpones !== null && x.$$typeof === REACT_POSTPONE_TYPE) {
10752+
// If we're tracking postpones, we mark this segment as postponed and finish
10753+
// the task without filling it in. If we're not tracking, we treat it more like
10754+
// an error.
10755+
var trackedPostpones = request.trackedPostpones;
10756+
task.abortSet.delete(task);
10757+
var postponeInstance = x;
10758+
logPostpone(request, postponeInstance.message);
10759+
trackPostpone(request, trackedPostpones, task, segment);
10760+
finishedTask(request, task.blockedBoundary, segment);
10761+
lastBoundaryErrorComponentStackDev = null;
10762+
return;
10763+
}
1074810764
}
1074910765

1075010766
task.abortSet.delete(task);
@@ -11145,7 +11161,10 @@ function flushCompletedQueues(request, destination) {
1114511161
var completedRootSegment = request.completedRootSegment;
1114611162

1114711163
if (completedRootSegment !== null) {
11148-
if (request.pendingRootTasks === 0) {
11164+
if (completedRootSegment.status === POSTPONED) {
11165+
// We postponed the root, so we write nothing.
11166+
return;
11167+
} else if (request.pendingRootTasks === 0) {
1114911168
if (enableFloat) {
1115011169
writePreamble(destination, request.resumableState, request.renderState, request.allPendingTasks === 0 && request.trackedPostpones === null);
1115111170
}

0 commit comments

Comments
 (0)
Please sign in to comment.