Skip to content

Commit

Permalink
Add support for rendering BigInt (#24580)
Browse files Browse the repository at this point in the history
DiffTrain build for [2f240c9](2f240c9)
  • Loading branch information
eps1lon committed Feb 26, 2024
1 parent 1c19e01 commit b29a80f
Show file tree
Hide file tree
Showing 25 changed files with 345 additions and 157 deletions.
2 changes: 1 addition & 1 deletion compiled/facebook-www/REVISION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
6c3b8dbfed6f879440f484bd0bf801fac67ec684
2f240c91ed54900adee213565cb2039e161629e9
26 changes: 16 additions & 10 deletions compiled/facebook-www/React-dev.classic.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ if (__DEV__) {
) {
__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(new Error());
}
var ReactVersion = "18.3.0-www-classic-c6726149";
var ReactVersion = "18.3.0-www-classic-cca960ca";

// ATTENTION
// When adding new symbols to this file,
Expand Down Expand Up @@ -396,6 +396,15 @@ if (__DEV__) {
return isArrayImpl(a);
}

// Re-export dynamic flags from the www version.
var dynamicFeatureFlags = require("ReactFeatureFlags");

var enableDebugTracing = dynamicFeatureFlags.enableDebugTracing,
enableTransitionTracing = dynamicFeatureFlags.enableTransitionTracing,
enableRefAsProp = dynamicFeatureFlags.enableRefAsProp;
// On WWW, false is used for a new modern build.
var enableRenderableContext = true;

/*
* The `'' + value` pattern (used in perf-sensitive code) throws for Symbol
* and Temporal.* types. See https://github.com/facebook/react/pull/22064.
Expand Down Expand Up @@ -470,15 +479,6 @@ if (__DEV__) {
}
}

// Re-export dynamic flags from the www version.
var dynamicFeatureFlags = require("ReactFeatureFlags");

var enableDebugTracing = dynamicFeatureFlags.enableDebugTracing,
enableTransitionTracing = dynamicFeatureFlags.enableTransitionTracing,
enableRefAsProp = dynamicFeatureFlags.enableRefAsProp;
// On WWW, false is used for a new modern build.
var enableRenderableContext = true;

function getWrappedName(outerType, innerType, wrapperName) {
var displayName = outerType.displayName;

Expand Down Expand Up @@ -2348,6 +2348,12 @@ if (__DEV__) {
invokeCallback = true;
} else {
switch (type) {
case "bigint": {
break;
}

// fallthrough for enabled BigInt support

case "string":
case "number":
invokeCallback = true;
Expand Down
26 changes: 16 additions & 10 deletions compiled/facebook-www/React-dev.modern.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ if (__DEV__) {
) {
__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(new Error());
}
var ReactVersion = "18.3.0-www-modern-91b2c91d";
var ReactVersion = "18.3.0-www-modern-f3ad7d8a";

// ATTENTION
// When adding new symbols to this file,
Expand Down Expand Up @@ -396,6 +396,15 @@ if (__DEV__) {
return isArrayImpl(a);
}

// Re-export dynamic flags from the www version.
var dynamicFeatureFlags = require("ReactFeatureFlags");

var enableDebugTracing = dynamicFeatureFlags.enableDebugTracing,
enableTransitionTracing = dynamicFeatureFlags.enableTransitionTracing,
enableRefAsProp = dynamicFeatureFlags.enableRefAsProp;
// On WWW, true is used for a new modern build.
var enableRenderableContext = true;

/*
* The `'' + value` pattern (used in perf-sensitive code) throws for Symbol
* and Temporal.* types. See https://github.com/facebook/react/pull/22064.
Expand Down Expand Up @@ -470,15 +479,6 @@ if (__DEV__) {
}
}

// Re-export dynamic flags from the www version.
var dynamicFeatureFlags = require("ReactFeatureFlags");

var enableDebugTracing = dynamicFeatureFlags.enableDebugTracing,
enableTransitionTracing = dynamicFeatureFlags.enableTransitionTracing,
enableRefAsProp = dynamicFeatureFlags.enableRefAsProp;
// On WWW, true is used for a new modern build.
var enableRenderableContext = true;

function getWrappedName(outerType, innerType, wrapperName) {
var displayName = outerType.displayName;

Expand Down Expand Up @@ -2304,6 +2304,12 @@ if (__DEV__) {
invokeCallback = true;
} else {
switch (type) {
case "bigint": {
break;
}

// fallthrough for enabled BigInt support

case "string":
case "number":
invokeCallback = true;
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 @@ -625,4 +625,4 @@ exports.useSyncExternalStore = function (
exports.useTransition = function () {
return ReactCurrentDispatcher.current.useTransition();
};
exports.version = "18.3.0-www-classic-2523b446";
exports.version = "18.3.0-www-classic-53c0b633";
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 @@ -617,4 +617,4 @@ exports.useSyncExternalStore = function (
exports.useTransition = function () {
return ReactCurrentDispatcher.current.useTransition();
};
exports.version = "18.3.0-www-modern-cc766bda";
exports.version = "18.3.0-www-modern-e541e76b";
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 @@ -629,7 +629,7 @@ exports.useSyncExternalStore = function (
exports.useTransition = function () {
return ReactCurrentDispatcher.current.useTransition();
};
exports.version = "18.3.0-www-classic-48808038";
exports.version = "18.3.0-www-classic-f64bbc43";
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&
"function" ===
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop &&
Expand Down
22 changes: 14 additions & 8 deletions compiled/facebook-www/ReactART-dev.classic.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ if (__DEV__) {
return self;
}

var ReactVersion = "18.3.0-www-classic-361724d4";
var ReactVersion = "18.3.0-www-classic-10cc6982";

var LegacyRoot = 0;
var ConcurrentRoot = 1;
Expand Down Expand Up @@ -198,6 +198,7 @@ if (__DEV__) {
var enableAsyncActions = true; // Logs additional User Timing API marks for use with an experimental profiling tool.

var enableSchedulingProfiler = dynamicFeatureFlags.enableSchedulingProfiler;
var enableBigIntSupport = false; // Flow magic to verify the exports of this file match the original version.

var FunctionComponent = 0;
var ClassComponent = 1;
Expand Down Expand Up @@ -6865,12 +6866,14 @@ if (__DEV__) {
function createChild(returnFiber, newChild, lanes, debugInfo) {
if (
(typeof newChild === "string" && newChild !== "") ||
typeof newChild === "number"
typeof newChild === "number" ||
enableBigIntSupport
) {
// Text nodes don't have keys. If the previous node is implicitly keyed
// we can continue to replace it without aborting even if it is not a text
// node.
var created = createFiberFromText(
// $FlowFixMe[unsafe-addition] Flow doesn't want us to use `+` operator with string and bigint
"" + newChild,
returnFiber.mode,
lanes
Expand Down Expand Up @@ -6998,7 +7001,8 @@ if (__DEV__) {

if (
(typeof newChild === "string" && newChild !== "") ||
typeof newChild === "number"
typeof newChild === "number" ||
enableBigIntSupport
) {
// Text nodes don't have keys. If the previous node is implicitly keyed
// we can continue to replace it without aborting even if it is not a text
Expand All @@ -7009,7 +7013,7 @@ if (__DEV__) {

return updateTextNode(
returnFiber,
oldFiber,
oldFiber, // $FlowFixMe[unsafe-addition] Flow doesn't want us to use `+` operator with string and bigint
"" + newChild,
lanes,
debugInfo
Expand Down Expand Up @@ -7124,14 +7128,15 @@ if (__DEV__) {
) {
if (
(typeof newChild === "string" && newChild !== "") ||
typeof newChild === "number"
typeof newChild === "number" ||
enableBigIntSupport
) {
// Text nodes don't have keys, so we neither have to check the old nor
// new node for the key. If both are text nodes, they match.
var matchedFiber = existingChildren.get(newIdx) || null;
return updateTextNode(
returnFiber,
matchedFiber,
matchedFiber, // $FlowFixMe[unsafe-addition] Flow doesn't want us to use `+` operator with string and bigint
"" + newChild,
lanes,
debugInfo
Expand Down Expand Up @@ -7972,12 +7977,13 @@ if (__DEV__) {

if (
(typeof newChild === "string" && newChild !== "") ||
typeof newChild === "number"
typeof newChild === "number" ||
enableBigIntSupport
) {
return placeSingleChild(
reconcileSingleTextNode(
returnFiber,
currentFirstChild,
currentFirstChild, // $FlowFixMe[unsafe-addition] Flow doesn't want us to use `+` operator with string and bigint
"" + newChild,
lanes
)
Expand Down
22 changes: 14 additions & 8 deletions compiled/facebook-www/ReactART-dev.modern.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ if (__DEV__) {
return self;
}

var ReactVersion = "18.3.0-www-modern-1f3124f7";
var ReactVersion = "18.3.0-www-modern-615fb07a";

var LegacyRoot = 0;
var ConcurrentRoot = 1;
Expand Down Expand Up @@ -198,6 +198,7 @@ if (__DEV__) {
var enableAsyncActions = true; // Logs additional User Timing API marks for use with an experimental profiling tool.

var enableSchedulingProfiler = dynamicFeatureFlags.enableSchedulingProfiler;
var enableBigIntSupport = false; // Flow magic to verify the exports of this file match the original version.

var FunctionComponent = 0;
var ClassComponent = 1;
Expand Down Expand Up @@ -6630,12 +6631,14 @@ if (__DEV__) {
function createChild(returnFiber, newChild, lanes, debugInfo) {
if (
(typeof newChild === "string" && newChild !== "") ||
typeof newChild === "number"
typeof newChild === "number" ||
enableBigIntSupport
) {
// Text nodes don't have keys. If the previous node is implicitly keyed
// we can continue to replace it without aborting even if it is not a text
// node.
var created = createFiberFromText(
// $FlowFixMe[unsafe-addition] Flow doesn't want us to use `+` operator with string and bigint
"" + newChild,
returnFiber.mode,
lanes
Expand Down Expand Up @@ -6763,7 +6766,8 @@ if (__DEV__) {

if (
(typeof newChild === "string" && newChild !== "") ||
typeof newChild === "number"
typeof newChild === "number" ||
enableBigIntSupport
) {
// Text nodes don't have keys. If the previous node is implicitly keyed
// we can continue to replace it without aborting even if it is not a text
Expand All @@ -6774,7 +6778,7 @@ if (__DEV__) {

return updateTextNode(
returnFiber,
oldFiber,
oldFiber, // $FlowFixMe[unsafe-addition] Flow doesn't want us to use `+` operator with string and bigint
"" + newChild,
lanes,
debugInfo
Expand Down Expand Up @@ -6889,14 +6893,15 @@ if (__DEV__) {
) {
if (
(typeof newChild === "string" && newChild !== "") ||
typeof newChild === "number"
typeof newChild === "number" ||
enableBigIntSupport
) {
// Text nodes don't have keys, so we neither have to check the old nor
// new node for the key. If both are text nodes, they match.
var matchedFiber = existingChildren.get(newIdx) || null;
return updateTextNode(
returnFiber,
matchedFiber,
matchedFiber, // $FlowFixMe[unsafe-addition] Flow doesn't want us to use `+` operator with string and bigint
"" + newChild,
lanes,
debugInfo
Expand Down Expand Up @@ -7737,12 +7742,13 @@ if (__DEV__) {

if (
(typeof newChild === "string" && newChild !== "") ||
typeof newChild === "number"
typeof newChild === "number" ||
enableBigIntSupport
) {
return placeSingleChild(
reconcileSingleTextNode(
returnFiber,
currentFirstChild,
currentFirstChild, // $FlowFixMe[unsafe-addition] Flow doesn't want us to use `+` operator with string and bigint
"" + newChild,
lanes
)
Expand Down
Loading

0 comments on commit b29a80f

Please sign in to comment.