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 commit 2f240c9.
  • Loading branch information
eps1lon committed Feb 26, 2024
1 parent 908dcaf commit d2778ef
Show file tree
Hide file tree
Showing 9 changed files with 75 additions and 51 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* @noflow
* @nolint
* @preventMunge
* @generated SignedSource<<cef9df27ccdfbbffd9d4f74c26147558>>
* @generated SignedSource<<2e02ad0f633511d087c31638317ef702>>
*/

"use strict";
Expand Down Expand Up @@ -148,6 +148,7 @@ if (__DEV__) {
var enableLegacyHidden = false;
var enableAsyncActions = true;
var alwaysThrottleRetries = true;
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 @@ -5538,12 +5539,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 @@ -5671,7 +5674,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 @@ -5682,7 +5686,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 @@ -5797,14 +5801,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 @@ -6645,12 +6650,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 Expand Up @@ -25727,7 +25733,7 @@ if (__DEV__) {
return root;
}

var ReactVersion = "18.3.0-canary-6c3b8dbfe-20240226";
var ReactVersion = "18.3.0-canary-2f240c91e-20240226";

// Might add PROFILE later.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9171,7 +9171,7 @@ var devToolsConfig$jscomp$inline_1014 = {
throw Error("TestRenderer does not support findFiberByHostInstance()");
},
bundleType: 0,
version: "18.3.0-canary-6c3b8dbfe-20240226",
version: "18.3.0-canary-2f240c91e-20240226",
rendererPackageName: "react-test-renderer"
};
var internals$jscomp$inline_1195 = {
Expand Down Expand Up @@ -9202,7 +9202,7 @@ var internals$jscomp$inline_1195 = {
scheduleRoot: null,
setRefreshHandler: null,
getCurrentFiber: null,
reconcilerVersion: "18.3.0-canary-6c3b8dbfe-20240226"
reconcilerVersion: "18.3.0-canary-2f240c91e-20240226"
};
if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) {
var hook$jscomp$inline_1196 = __REACT_DEVTOOLS_GLOBAL_HOOK__;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9599,7 +9599,7 @@ var devToolsConfig$jscomp$inline_1056 = {
throw Error("TestRenderer does not support findFiberByHostInstance()");
},
bundleType: 0,
version: "18.3.0-canary-6c3b8dbfe-20240226",
version: "18.3.0-canary-2f240c91e-20240226",
rendererPackageName: "react-test-renderer"
};
var internals$jscomp$inline_1236 = {
Expand Down Expand Up @@ -9630,7 +9630,7 @@ var internals$jscomp$inline_1236 = {
scheduleRoot: null,
setRefreshHandler: null,
getCurrentFiber: null,
reconcilerVersion: "18.3.0-canary-6c3b8dbfe-20240226"
reconcilerVersion: "18.3.0-canary-2f240c91e-20240226"
};
if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) {
var hook$jscomp$inline_1237 = __REACT_DEVTOOLS_GLOBAL_HOOK__;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* @noflow
* @nolint
* @preventMunge
* @generated SignedSource<<44c5c601c5193aa81af150ccb4208604>>
* @generated SignedSource<<11b286062c8512965799ad8e36092d6b>>
*/

"use strict";
Expand All @@ -26,7 +26,7 @@ if (__DEV__) {
}
var dynamicFlags = require("ReactNativeInternalFeatureFlags");

var ReactVersion = "18.3.0-canary-6c3b8dbfe-20240226";
var ReactVersion = "18.3.0-canary-2f240c91e-20240226";

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

// NOTE: There are no flags, currently. Uncomment the stuff below if we add one.
// the exports object every time a flag is read.

var enableComponentStackLocations =
dynamicFlags.enableComponentStackLocations;
// The rest of the flags are static for better dead code elimination.
var enableDebugTracing = false;
var enableScopeAPI = false;
var enableRenderableContext = false;
var enableLegacyHidden = false;
var enableTransitionTracing = false;
// because JSX is an extremely hot path.

var enableRefAsProp = false;

/*
* 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 @@ -564,21 +579,6 @@ if (__DEV__) {
}
}

// NOTE: There are no flags, currently. Uncomment the stuff below if we add one.
// the exports object every time a flag is read.

var enableComponentStackLocations =
dynamicFlags.enableComponentStackLocations;
// The rest of the flags are static for better dead code elimination.
var enableDebugTracing = false;
var enableScopeAPI = false;
var enableRenderableContext = false;
var enableLegacyHidden = false;
var enableTransitionTracing = false;
// because JSX is an extremely hot path.

var enableRefAsProp = false;

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

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

// fallthrough for enabled BigInt support

case "string":
case "number":
invokeCallback = true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -598,4 +598,4 @@ exports.useSyncExternalStore = function (
exports.useTransition = function () {
return ReactCurrentDispatcher.current.useTransition();
};
exports.version = "18.3.0-canary-6c3b8dbfe-20240226";
exports.version = "18.3.0-canary-2f240c91e-20240226";
Original file line number Diff line number Diff line change
Expand Up @@ -594,7 +594,7 @@ exports.useSyncExternalStore = function (
exports.useTransition = function () {
return ReactCurrentDispatcher.current.useTransition();
};
exports.version = "18.3.0-canary-6c3b8dbfe-20240226";
exports.version = "18.3.0-canary-2f240c91e-20240226";
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&
"function" ===
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop &&
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
6c3b8dbfed6f879440f484bd0bf801fac67ec684
2f240c91ed54900adee213565cb2039e161629e9
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* @noflow
* @nolint
* @preventMunge
* @generated SignedSource<<575cc3b40a7c3dee749cf6fb176a4449>>
* @generated SignedSource<<36563f58fdb8036d760d09bb1e80c450>>
*/

"use strict";
Expand Down Expand Up @@ -3248,6 +3248,7 @@ to return true:wantsResponderID| |
var enableLazyContextPropagation = false;
var enableLegacyHidden = false;
var enableAsyncActions = false;
var enableBigIntSupport = false; // Flow magic to verify the exports of this file match the original version.

var NoFlags$1 =
/* */
Expand Down Expand Up @@ -9445,12 +9446,14 @@ to return true:wantsResponderID| |
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 @@ -9578,7 +9581,8 @@ to return true:wantsResponderID| |

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 @@ -9589,7 +9593,7 @@ to return true:wantsResponderID| |

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 @@ -9704,14 +9708,15 @@ to return true:wantsResponderID| |
) {
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 @@ -10552,12 +10557,13 @@ to return true:wantsResponderID| |

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 Expand Up @@ -28034,7 +28040,7 @@ to return true:wantsResponderID| |
return root;
}

var ReactVersion = "18.3.0-canary-6032fc8f";
var ReactVersion = "18.3.0-canary-49d61be7";

function createPortal$1(
children,
Expand Down
Loading

0 comments on commit d2778ef

Please sign in to comment.