Skip to content

Commit

Permalink
toString children of title (#25838)
Browse files Browse the repository at this point in the history
children of title can either behave like children or like an attribute.
We're kind of treating it more like an attribute now so we should
support toString/valueOf like we do on attributes.

DiffTrain build for `bfcbf3306794eb3de37d866551127fc2bdae53d7`
  • Loading branch information
sebmarkbage committed Dec 7, 2022
1 parent eb06c12 commit 8482210
Show file tree
Hide file tree
Showing 36 changed files with 553 additions and 320 deletions.
2 changes: 1 addition & 1 deletion compiled/facebook-www/REVISION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
d4bc16a7d69eb2ea38a88c8ac0b461d5f72cdcab
bfcbf3306794eb3de37d866551127fc2bdae53d7
2 changes: 1 addition & 1 deletion compiled/facebook-www/REVISION_TRANSFORMS
Original file line number Diff line number Diff line change
@@ -1 +1 @@
d4bc16a7d69eb2ea38a88c8ac0b461d5f72cdcab
bfcbf3306794eb3de37d866551127fc2bdae53d7
2 changes: 1 addition & 1 deletion compiled/facebook-www/React-dev.classic.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ if (
}
"use strict";

var ReactVersion = "18.3.0-www-classic-d4bc16a7d-20221206";
var ReactVersion = "18.3.0-www-classic-bfcbf3306-20221207";

// ATTENTION
// When adding new symbols to this file,
Expand Down
2 changes: 1 addition & 1 deletion compiled/facebook-www/React-dev.modern.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ if (
}
"use strict";

var ReactVersion = "18.3.0-www-modern-d4bc16a7d-20221206";
var ReactVersion = "18.3.0-www-modern-bfcbf3306-20221207";

// ATTENTION
// When adding new symbols to this file,
Expand Down
2 changes: 1 addition & 1 deletion compiled/facebook-www/React-prod.classic.js
Original file line number Diff line number Diff line change
Expand Up @@ -643,4 +643,4 @@ exports.useSyncExternalStore = function(
);
};
exports.useTransition = useTransition;
exports.version = "18.3.0-www-classic-d4bc16a7d-20221206";
exports.version = "18.3.0-www-classic-bfcbf3306-20221207";
2 changes: 1 addition & 1 deletion compiled/facebook-www/React-prod.modern.js
Original file line number Diff line number Diff line change
Expand Up @@ -635,4 +635,4 @@ exports.useSyncExternalStore = function(
);
};
exports.useTransition = useTransition;
exports.version = "18.3.0-www-modern-d4bc16a7d-20221206";
exports.version = "18.3.0-www-modern-bfcbf3306-20221207";
2 changes: 1 addition & 1 deletion compiled/facebook-www/React-profiling.classic.js
Original file line number Diff line number Diff line change
Expand Up @@ -654,7 +654,7 @@ exports.useSyncExternalStore = function(
);
};
exports.useTransition = useTransition;
exports.version = "18.3.0-www-classic-d4bc16a7d-20221206";
exports.version = "18.3.0-www-classic-bfcbf3306-20221207";

/* global __REACT_DEVTOOLS_GLOBAL_HOOK__ */
if (
Expand Down
2 changes: 1 addition & 1 deletion compiled/facebook-www/React-profiling.modern.js
Original file line number Diff line number Diff line change
Expand Up @@ -646,7 +646,7 @@ exports.useSyncExternalStore = function(
);
};
exports.useTransition = useTransition;
exports.version = "18.3.0-www-modern-d4bc16a7d-20221206";
exports.version = "18.3.0-www-modern-bfcbf3306-20221207";

/* global __REACT_DEVTOOLS_GLOBAL_HOOK__ */
if (
Expand Down
2 changes: 1 addition & 1 deletion compiled/facebook-www/ReactART-dev.classic.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ function _assertThisInitialized(self) {
return self;
}

var ReactVersion = "18.3.0-www-classic-d4bc16a7d-20221206";
var ReactVersion = "18.3.0-www-classic-bfcbf3306-20221207";

var LegacyRoot = 0;
var ConcurrentRoot = 1;
Expand Down
2 changes: 1 addition & 1 deletion compiled/facebook-www/ReactART-dev.modern.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ function _assertThisInitialized(self) {
return self;
}

var ReactVersion = "18.3.0-www-modern-d4bc16a7d-20221206";
var ReactVersion = "18.3.0-www-modern-bfcbf3306-20221207";

var LegacyRoot = 0;
var ConcurrentRoot = 1;
Expand Down
4 changes: 2 additions & 2 deletions compiled/facebook-www/ReactART-prod.classic.js
Original file line number Diff line number Diff line change
Expand Up @@ -9782,7 +9782,7 @@ var slice = Array.prototype.slice,
return null;
},
bundleType: 0,
version: "18.3.0-www-classic-d4bc16a7d-20221206",
version: "18.3.0-www-classic-bfcbf3306-20221207",
rendererPackageName: "react-art"
};
var internals$jscomp$inline_1336 = {
Expand Down Expand Up @@ -9813,7 +9813,7 @@ var internals$jscomp$inline_1336 = {
scheduleRoot: null,
setRefreshHandler: null,
getCurrentFiber: null,
reconcilerVersion: "18.3.0-next-d4bc16a7d-20221206"
reconcilerVersion: "18.3.0-next-bfcbf3306-20221207"
};
if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) {
var hook$jscomp$inline_1337 = __REACT_DEVTOOLS_GLOBAL_HOOK__;
Expand Down
4 changes: 2 additions & 2 deletions compiled/facebook-www/ReactART-prod.modern.js
Original file line number Diff line number Diff line change
Expand Up @@ -9449,7 +9449,7 @@ var slice = Array.prototype.slice,
return null;
},
bundleType: 0,
version: "18.3.0-www-modern-d4bc16a7d-20221206",
version: "18.3.0-www-modern-bfcbf3306-20221207",
rendererPackageName: "react-art"
};
var internals$jscomp$inline_1327 = {
Expand Down Expand Up @@ -9480,7 +9480,7 @@ var internals$jscomp$inline_1327 = {
scheduleRoot: null,
setRefreshHandler: null,
getCurrentFiber: null,
reconcilerVersion: "18.3.0-next-d4bc16a7d-20221206"
reconcilerVersion: "18.3.0-next-bfcbf3306-20221207"
};
if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) {
var hook$jscomp$inline_1328 = __REACT_DEVTOOLS_GLOBAL_HOOK__;
Expand Down
25 changes: 18 additions & 7 deletions compiled/facebook-www/ReactDOM-dev.classic.js
Original file line number Diff line number Diff line change
Expand Up @@ -10116,22 +10116,33 @@ function getResource(type, pendingProps, currentProps) {
}

case "title": {
var child = pendingProps.children;
var children = pendingProps.children;
var child;

if (Array.isArray(child) && child.length === 1) {
child = child[0];
if (Array.isArray(children)) {
child = children.length === 1 ? children[0] : null;
} else {
child = children;
}

if (typeof child === "string" || typeof child === "number") {
if (
typeof child !== "function" &&
typeof child !== "symbol" &&
child !== null &&
child !== undefined
) {
// eslint-disable-next-line react-internal/safe-string-coercion
var childString = "" + child;

var _headRoot2 = getDocumentFromRoot(resourceRoot);

var _headResources2 = getResourcesFromRoot(_headRoot2).head;
var key = getTitleKey(child);
var key = getTitleKey(childString);

var _resource3 = _headResources2.get(key);

if (!_resource3) {
var titleProps = titlePropsFromRawProps(child, pendingProps);
var titleProps = titlePropsFromRawProps(childString, pendingProps);
_resource3 = {
type: "title",
props: titleProps,
Expand Down Expand Up @@ -42519,7 +42530,7 @@ function createFiberRoot(
return root;
}

var ReactVersion = "18.3.0-www-classic-d4bc16a7d-20221206";
var ReactVersion = "18.3.0-www-classic-bfcbf3306-20221207";

function createPortal(
children,
Expand Down
25 changes: 18 additions & 7 deletions compiled/facebook-www/ReactDOM-dev.modern.js
Original file line number Diff line number Diff line change
Expand Up @@ -14620,22 +14620,33 @@ function getResource(type, pendingProps, currentProps) {
}

case "title": {
var child = pendingProps.children;
var children = pendingProps.children;
var child;

if (Array.isArray(child) && child.length === 1) {
child = child[0];
if (Array.isArray(children)) {
child = children.length === 1 ? children[0] : null;
} else {
child = children;
}

if (typeof child === "string" || typeof child === "number") {
if (
typeof child !== "function" &&
typeof child !== "symbol" &&
child !== null &&
child !== undefined
) {
// eslint-disable-next-line react-internal/safe-string-coercion
var childString = "" + child;

var _headRoot2 = getDocumentFromRoot(resourceRoot);

var _headResources2 = getResourcesFromRoot(_headRoot2).head;
var key = getTitleKey(child);
var key = getTitleKey(childString);

var _resource3 = _headResources2.get(key);

if (!_resource3) {
var titleProps = titlePropsFromRawProps(child, pendingProps);
var titleProps = titlePropsFromRawProps(childString, pendingProps);
_resource3 = {
type: "title",
props: titleProps,
Expand Down Expand Up @@ -42243,7 +42254,7 @@ function createFiberRoot(
return root;
}

var ReactVersion = "18.3.0-www-modern-d4bc16a7d-20221206";
var ReactVersion = "18.3.0-www-modern-bfcbf3306-20221207";

function createPortal(
children,
Expand Down
32 changes: 20 additions & 12 deletions compiled/facebook-www/ReactDOM-prod.classic.js
Original file line number Diff line number Diff line change
Expand Up @@ -2117,24 +2117,32 @@ function getResource(type, pendingProps) {
: null;
case "title":
return (
(href = pendingProps.children),
Array.isArray(href) && 1 === href.length && (href = href[0]),
"string" === typeof href || "number" === typeof href
? ((resourceRoot = getDocumentFromRoot(resourceRoot)),
(headResources = getResourcesFromRoot(resourceRoot).head),
(target = "title:" + href),
(type = headResources.get(target)),
(headResources = pendingProps.children),
(headResources = Array.isArray(headResources)
? 1 === headResources.length
? headResources[0]
: null
: headResources),
"function" !== typeof headResources &&
"symbol" !== typeof headResources &&
null !== headResources &&
void 0 !== headResources
? ((headResources = "" + headResources),
(resourceRoot = getDocumentFromRoot(resourceRoot)),
(target = getResourcesFromRoot(resourceRoot).head),
(href = "title:" + headResources),
(type = target.get(href)),
type ||
((pendingProps = assign({}, pendingProps)),
(pendingProps.children = href),
(pendingProps.children = headResources),
(type = {
type: "title",
props: pendingProps,
count: 0,
instance: null,
root: resourceRoot
}),
headResources.set(target, type)),
target.set(href, type)),
type)
: null
);
Expand Down Expand Up @@ -15529,7 +15537,7 @@ Internals.Events = [
var devToolsConfig$jscomp$inline_1773 = {
findFiberByHostInstance: getClosestInstanceFromNode,
bundleType: 0,
version: "18.3.0-www-classic-d4bc16a7d-20221206",
version: "18.3.0-www-classic-bfcbf3306-20221207",
rendererPackageName: "react-dom"
};
var internals$jscomp$inline_2154 = {
Expand Down Expand Up @@ -15559,7 +15567,7 @@ var internals$jscomp$inline_2154 = {
scheduleRoot: null,
setRefreshHandler: null,
getCurrentFiber: null,
reconcilerVersion: "18.3.0-next-d4bc16a7d-20221206"
reconcilerVersion: "18.3.0-next-bfcbf3306-20221207"
};
if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) {
var hook$jscomp$inline_2155 = __REACT_DEVTOOLS_GLOBAL_HOOK__;
Expand Down Expand Up @@ -15801,4 +15809,4 @@ exports.unstable_renderSubtreeIntoContainer = function(
);
};
exports.unstable_runWithPriority = runWithPriority;
exports.version = "18.3.0-next-d4bc16a7d-20221206";
exports.version = "18.3.0-next-bfcbf3306-20221207";
32 changes: 20 additions & 12 deletions compiled/facebook-www/ReactDOM-prod.modern.js
Original file line number Diff line number Diff line change
Expand Up @@ -4329,24 +4329,32 @@ function getResource(type, pendingProps) {
: null;
case "title":
return (
(href = pendingProps.children),
Array.isArray(href) && 1 === href.length && (href = href[0]),
"string" === typeof href || "number" === typeof href
? ((resourceRoot = getDocumentFromRoot(resourceRoot)),
(headResources = getResourcesFromRoot(resourceRoot).head),
(target = "title:" + href),
(type = headResources.get(target)),
(headResources = pendingProps.children),
(headResources = Array.isArray(headResources)
? 1 === headResources.length
? headResources[0]
: null
: headResources),
"function" !== typeof headResources &&
"symbol" !== typeof headResources &&
null !== headResources &&
void 0 !== headResources
? ((headResources = "" + headResources),
(resourceRoot = getDocumentFromRoot(resourceRoot)),
(target = getResourcesFromRoot(resourceRoot).head),
(href = "title:" + headResources),
(type = target.get(href)),
type ||
((pendingProps = assign({}, pendingProps)),
(pendingProps.children = href),
(pendingProps.children = headResources),
(type = {
type: "title",
props: pendingProps,
count: 0,
instance: null,
root: resourceRoot
}),
headResources.set(target, type)),
target.set(href, type)),
type)
: null
);
Expand Down Expand Up @@ -15090,7 +15098,7 @@ Internals.Events = [
var devToolsConfig$jscomp$inline_1741 = {
findFiberByHostInstance: getClosestInstanceFromNode,
bundleType: 0,
version: "18.3.0-www-modern-d4bc16a7d-20221206",
version: "18.3.0-www-modern-bfcbf3306-20221207",
rendererPackageName: "react-dom"
};
var internals$jscomp$inline_2129 = {
Expand Down Expand Up @@ -15121,7 +15129,7 @@ var internals$jscomp$inline_2129 = {
scheduleRoot: null,
setRefreshHandler: null,
getCurrentFiber: null,
reconcilerVersion: "18.3.0-next-d4bc16a7d-20221206"
reconcilerVersion: "18.3.0-next-bfcbf3306-20221207"
};
if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) {
var hook$jscomp$inline_2130 = __REACT_DEVTOOLS_GLOBAL_HOOK__;
Expand Down Expand Up @@ -15309,4 +15317,4 @@ exports.unstable_flushControlled = function(fn) {
}
};
exports.unstable_runWithPriority = runWithPriority;
exports.version = "18.3.0-next-d4bc16a7d-20221206";
exports.version = "18.3.0-next-bfcbf3306-20221207";
Loading

0 comments on commit 8482210

Please sign in to comment.