Skip to content

Commit

Permalink
Update react next channel (#42021)
Browse files Browse the repository at this point in the history
Update react channel for `fetch` patching updates 

x-ref: [slack
thread](https://vercel.slack.com/archives/C03ENM5HB4K/p1666802006931969?thread_ts=1666799939.726859&cid=C03ENM5HB4K)
  • Loading branch information
huozhi authored Oct 28, 2022
1 parent 65083f8 commit 70e7e58
Show file tree
Hide file tree
Showing 21 changed files with 363 additions and 306 deletions.
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -178,11 +178,11 @@
"random-seed": "0.3.0",
"react": "18.2.0",
"react-17": "npm:react@17.0.2",
"react-builtin": "npm:react@18.3.0-next-d925a8d0b-20221024",
"react-builtin": "npm:react@18.3.0-next-28a574ea8-20221027",
"react-dom": "18.2.0",
"react-dom-17": "npm:react-dom@17.0.2",
"react-dom-builtin": "npm:react-dom@18.3.0-next-d925a8d0b-20221024",
"react-server-dom-webpack": "18.3.0-next-d925a8d0b-20221024",
"react-dom-builtin": "npm:react-dom@18.3.0-next-28a574ea8-20221027",
"react-server-dom-webpack": "18.3.0-next-28a574ea8-20221027",
"react-ssr-prepass": "1.0.8",
"react-virtualized": "9.22.3",
"relay-compiler": "13.0.2",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ if (process.env.NODE_ENV !== "production") {
var React = require('react');
var ReactDOM = require('react-dom');

var ReactVersion = '18.3.0-next-d925a8d0b-20221024';
var ReactVersion = '18.3.0-next-28a574ea8-20221027';

var ReactSharedInternals = React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;

Expand Down Expand Up @@ -2710,7 +2710,11 @@ function resourcesFromLink(props) {
}

if (props.onLoad || props.onError) {
return false;
// When a link has these props we can't treat it is a Resource but if we rendered it on the
// server it would look like a Resource in the rendered html (the onLoad/onError aren't emitted)
// Instead we expect the client to insert them rather than hydrate them which also guarantees
// that the onLoad and onError won't fire before the event handlers are attached
return true;
}

var sizes = typeof props.sizes === 'string' ? props.sizes : '';
Expand Down Expand Up @@ -2938,52 +2942,56 @@ var HTML_TABLE_ROW_MODE = 6;
var HTML_COLGROUP_MODE = 7; // We have a greater than HTML_TABLE_MODE check elsewhere. If you add more cases here, make sure it
// still makes sense

function createFormatContext(insertionMode, selectedValue) {
function createFormatContext(insertionMode, selectedValue, noscriptTagInScope) {
return {
insertionMode: insertionMode,
selectedValue: selectedValue
selectedValue: selectedValue,
noscriptTagInScope: noscriptTagInScope
};
}
function getChildFormatContext(parentContext, type, props) {
switch (type) {
case 'noscript':
return createFormatContext(HTML_MODE, null, true);

case 'select':
return createFormatContext(HTML_MODE, props.value != null ? props.value : props.defaultValue);
return createFormatContext(HTML_MODE, props.value != null ? props.value : props.defaultValue, parentContext.noscriptTagInScope);

case 'svg':
return createFormatContext(SVG_MODE, null);
return createFormatContext(SVG_MODE, null, parentContext.noscriptTagInScope);

case 'math':
return createFormatContext(MATHML_MODE, null);
return createFormatContext(MATHML_MODE, null, parentContext.noscriptTagInScope);

case 'foreignObject':
return createFormatContext(HTML_MODE, null);
return createFormatContext(HTML_MODE, null, parentContext.noscriptTagInScope);
// Table parents are special in that their children can only be created at all if they're
// wrapped in a table parent. So we need to encode that we're entering this mode.

case 'table':
return createFormatContext(HTML_TABLE_MODE, null);
return createFormatContext(HTML_TABLE_MODE, null, parentContext.noscriptTagInScope);

case 'thead':
case 'tbody':
case 'tfoot':
return createFormatContext(HTML_TABLE_BODY_MODE, null);
return createFormatContext(HTML_TABLE_BODY_MODE, null, parentContext.noscriptTagInScope);

case 'colgroup':
return createFormatContext(HTML_COLGROUP_MODE, null);
return createFormatContext(HTML_COLGROUP_MODE, null, parentContext.noscriptTagInScope);

case 'tr':
return createFormatContext(HTML_TABLE_ROW_MODE, null);
return createFormatContext(HTML_TABLE_ROW_MODE, null, parentContext.noscriptTagInScope);
}

if (parentContext.insertionMode >= HTML_TABLE_MODE) {
// Whatever tag this was, it wasn't a table parent or other special parent, so we must have
// entered plain HTML again.
return createFormatContext(HTML_MODE, null);
return createFormatContext(HTML_MODE, null, parentContext.noscriptTagInScope);
}

if (parentContext.insertionMode === ROOT_HTML_MODE) {
// We've emitted the root and is now in plain HTML mode.
return createFormatContext(HTML_MODE, null);
return createFormatContext(HTML_MODE, null, parentContext.noscriptTagInScope);
}

return parentContext;
Expand Down Expand Up @@ -3663,8 +3671,8 @@ function pushStartTextArea(target, props, responseState) {
return null;
}

function pushBase(target, props, responseState, textEmbedded) {
if ( resourcesFromElement('base', props)) {
function pushBase(target, props, responseState, textEmbedded, noscriptTagInScope) {
if ( !noscriptTagInScope && resourcesFromElement('base', props)) {
if (textEmbedded) {
// This link follows text but we aren't writing a tag. while not as efficient as possible we need
// to be safe and assume text will follow by inserting a textSeparator
Expand All @@ -3679,8 +3687,8 @@ function pushBase(target, props, responseState, textEmbedded) {
return pushSelfClosing(target, props, 'base', responseState);
}

function pushMeta(target, props, responseState, textEmbedded) {
if ( resourcesFromElement('meta', props)) {
function pushMeta(target, props, responseState, textEmbedded, noscriptTagInScope) {
if ( !noscriptTagInScope && resourcesFromElement('meta', props)) {
if (textEmbedded) {
// This link follows text but we aren't writing a tag. while not as efficient as possible we need
// to be safe and assume text will follow by inserting a textSeparator
Expand All @@ -3695,8 +3703,8 @@ function pushMeta(target, props, responseState, textEmbedded) {
return pushSelfClosing(target, props, 'meta', responseState);
}

function pushLink(target, props, responseState, textEmbedded) {
if ( resourcesFromLink(props)) {
function pushLink(target, props, responseState, textEmbedded, noscriptTagInScope) {
if ( !noscriptTagInScope && resourcesFromLink(props)) {
if (textEmbedded) {
// This link follows text but we aren't writing a tag. while not as efficient as possible we need
// to be safe and assume text will follow by inserting a textSeparator
Expand Down Expand Up @@ -3805,7 +3813,7 @@ function pushStartMenuItem(target, props, responseState) {
return null;
}

function pushTitle(target, props, responseState) {
function pushTitle(target, props, responseState, noscriptTagInScope) {
{
var children = props.children;
var childForValidation = Array.isArray(children) && children.length < 2 ? children[0] || null : children;
Expand All @@ -3819,7 +3827,7 @@ function pushTitle(target, props, responseState) {
}
}

if ( resourcesFromElement('title', props)) {
if ( !noscriptTagInScope && resourcesFromElement('title', props)) {
// We have converted this link exclusively to a resource and no longer
// need to emit it
return null;
Expand Down Expand Up @@ -3884,8 +3892,8 @@ function pushStartHtml(target, preamble, props, tag, responseState, formatContex
return pushStartGenericElement(target, props, tag, responseState);
}

function pushScript(target, props, responseState, textEmbedded) {
if ( resourcesFromScript(props)) {
function pushScript(target, props, responseState, textEmbedded, noscriptTagInScope) {
if ( !noscriptTagInScope && resourcesFromScript(props)) {
if (textEmbedded) {
// This link follows text but we aren't writing a tag. while not as efficient as possible we need
// to be safe and assume text will follow by inserting a textSeparator
Expand Down Expand Up @@ -4170,19 +4178,19 @@ function pushStartInstance(target, preamble, type, props, responseState, formatC
return pushStartMenuItem(target, props, responseState);

case 'title':
return pushTitle(target, props, responseState) ;
return pushTitle(target, props, responseState, formatContext.noscriptTagInScope) ;

case 'link':
return pushLink(target, props, responseState, textEmbedded);
return pushLink(target, props, responseState, textEmbedded, formatContext.noscriptTagInScope);

case 'script':
return pushScript(target, props, responseState, textEmbedded) ;
return pushScript(target, props, responseState, textEmbedded, formatContext.noscriptTagInScope) ;

case 'meta':
return pushMeta(target, props, responseState, textEmbedded);
return pushMeta(target, props, responseState, textEmbedded, formatContext.noscriptTagInScope);

case 'base':
return pushBase(target, props, responseState, textEmbedded);
return pushBase(target, props, responseState, textEmbedded, formatContext.noscriptTagInScope);
// Newline eating tags

case 'listing':
Expand Down Expand Up @@ -5099,7 +5107,8 @@ function createRootFormatContext() {
return {
insertionMode: HTML_MODE,
// We skip the root mode because we don't want to emit the DOCTYPE in legacy mode.
selectedValue: null
selectedValue: null,
noscriptTagInScope: false
};
}
function pushTextInstance$1(target, text, responseState, textEmbedded) {
Expand Down
Loading

0 comments on commit 70e7e58

Please sign in to comment.