mirror of
https://github.com/facebook/react.git
synced 2025-11-01 09:12:30 +00:00
Introduce a faster version of the addProperties function (#28969)
## Summary This PR introduces a faster version of the `addProperties` function. This new function is basically the `diffProperties` with `prevProps` set to `null`, propagated constants, and all the unreachable code paths collapsed. ## How did you test this change? I've tested this change with [the benchmark app](https://github.com/react-native-community/RNNewArchitectureApp/tree/new-architecture-benchmarks) and got ~4.4% improvement in the view creation time. DiffTrain build for commit https://github.com/facebook/react/commit/73bcdfbae57545aa8f88ecdf67426275610b5573.
This commit is contained in:
+3
-2
@@ -7,7 +7,7 @@
|
||||
* @noflow
|
||||
* @nolint
|
||||
* @preventMunge
|
||||
* @generated SignedSource<<4c8919e8adb15c1f31e630f08e73d86f>>
|
||||
* @generated SignedSource<<af4ef85b8fe75e4033608d078d795833>>
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
@@ -25,7 +25,8 @@ var dynamicFlags = dynamicFlagsUntyped; // We destructure each value before re-e
|
||||
|
||||
var enableComponentStackLocations = dynamicFlags.enableComponentStackLocations,
|
||||
enableRenderableContext = dynamicFlags.enableRenderableContext,
|
||||
disableDefaultPropsExceptForClasses = dynamicFlags.disableDefaultPropsExceptForClasses; // The rest of the flags are static for better dead code elimination.
|
||||
disableDefaultPropsExceptForClasses = dynamicFlags.disableDefaultPropsExceptForClasses;
|
||||
// The rest of the flags are static for better dead code elimination.
|
||||
var enableDebugTracing = false;
|
||||
var enableScopeAPI = false;
|
||||
var enableLegacyHidden = false;
|
||||
|
||||
+3
-2
@@ -7,7 +7,7 @@
|
||||
* @noflow
|
||||
* @nolint
|
||||
* @preventMunge
|
||||
* @generated SignedSource<<659c779c0ac134a5010cd8f6556b1b17>>
|
||||
* @generated SignedSource<<ce4cd05ddf193df647a49f1ddbcc0aed>>
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
@@ -25,7 +25,8 @@ var dynamicFlags = dynamicFlagsUntyped; // We destructure each value before re-e
|
||||
|
||||
var enableComponentStackLocations = dynamicFlags.enableComponentStackLocations,
|
||||
enableRenderableContext = dynamicFlags.enableRenderableContext,
|
||||
disableDefaultPropsExceptForClasses = dynamicFlags.disableDefaultPropsExceptForClasses; // The rest of the flags are static for better dead code elimination.
|
||||
disableDefaultPropsExceptForClasses = dynamicFlags.disableDefaultPropsExceptForClasses;
|
||||
// The rest of the flags are static for better dead code elimination.
|
||||
var enableDebugTracing = false;
|
||||
var enableScopeAPI = false;
|
||||
var enableLegacyHidden = false;
|
||||
|
||||
+4
-3
@@ -7,7 +7,7 @@
|
||||
* @noflow
|
||||
* @nolint
|
||||
* @preventMunge
|
||||
* @generated SignedSource<<0f88cc3fda756e3467304abd247a3db7>>
|
||||
* @generated SignedSource<<f47b166be53dccb56c8e3adcf1ba0dfb>>
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
@@ -27,7 +27,7 @@ if (
|
||||
}
|
||||
var dynamicFlagsUntyped = require('ReactNativeInternalFeatureFlags');
|
||||
|
||||
var ReactVersion = '19.0.0-beta-6a68f48e';
|
||||
var ReactVersion = '19.0.0-beta-45cd200f';
|
||||
|
||||
// Re-export dynamic flags from the internal module.
|
||||
var dynamicFlags = dynamicFlagsUntyped; // We destructure each value before re-exporting to avoid a dynamic look-up on
|
||||
@@ -36,7 +36,8 @@ var dynamicFlags = dynamicFlagsUntyped; // We destructure each value before re-e
|
||||
var enableAsyncActions = dynamicFlags.enableAsyncActions,
|
||||
enableComponentStackLocations = dynamicFlags.enableComponentStackLocations,
|
||||
enableRenderableContext = dynamicFlags.enableRenderableContext,
|
||||
disableDefaultPropsExceptForClasses = dynamicFlags.disableDefaultPropsExceptForClasses; // The rest of the flags are static for better dead code elimination.
|
||||
disableDefaultPropsExceptForClasses = dynamicFlags.disableDefaultPropsExceptForClasses;
|
||||
// The rest of the flags are static for better dead code elimination.
|
||||
var enableDebugTracing = false;
|
||||
var enableScopeAPI = false;
|
||||
var enableLegacyHidden = false;
|
||||
|
||||
+1
-1
@@ -1 +1 @@
|
||||
4508873393058e86bed308b56e49ec883ece59d1
|
||||
73bcdfbae57545aa8f88ecdf67426275610b5573
|
||||
|
||||
+62
-5
@@ -7,7 +7,7 @@
|
||||
* @noflow
|
||||
* @nolint
|
||||
* @preventMunge
|
||||
* @generated SignedSource<<3b1926ec8be22ff21a461aebe15a8dec>>
|
||||
* @generated SignedSource<<438e1cd98ae204c6c07245d77bdf2eb2>>
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
@@ -2003,7 +2003,8 @@ var alwaysThrottleRetries = dynamicFlags.alwaysThrottleRetries,
|
||||
enableUnifiedSyncLane = dynamicFlags.enableUnifiedSyncLane,
|
||||
passChildrenWhenCloningPersistedNodes = dynamicFlags.passChildrenWhenCloningPersistedNodes,
|
||||
useModernStrictMode = dynamicFlags.useModernStrictMode,
|
||||
disableDefaultPropsExceptForClasses = dynamicFlags.disableDefaultPropsExceptForClasses; // The rest of the flags are static for better dead code elimination.
|
||||
disableDefaultPropsExceptForClasses = dynamicFlags.disableDefaultPropsExceptForClasses,
|
||||
enableAddPropertiesFastPath = dynamicFlags.enableAddPropertiesFastPath; // The rest of the flags are static for better dead code elimination.
|
||||
var enableSchedulingProfiler = true;
|
||||
var enableProfilerTimer = true;
|
||||
var enableProfilerCommitHooks = true;
|
||||
@@ -2352,14 +2353,70 @@ function diffProperties(updatePayload, prevProps, nextProps, validAttributes) {
|
||||
|
||||
return updatePayload;
|
||||
}
|
||||
|
||||
function fastAddProperties(updatePayload, nextProps, validAttributes) {
|
||||
var attributeConfig;
|
||||
var nextProp;
|
||||
|
||||
for (var propKey in nextProps) {
|
||||
nextProp = nextProps[propKey];
|
||||
|
||||
if (nextProp === undefined) {
|
||||
continue;
|
||||
}
|
||||
|
||||
attributeConfig = validAttributes[propKey];
|
||||
|
||||
if (attributeConfig === undefined) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (typeof nextProp === 'function') {
|
||||
nextProp = true;
|
||||
}
|
||||
|
||||
if (typeof attributeConfig !== 'object') {
|
||||
if (!updatePayload) {
|
||||
updatePayload = {};
|
||||
}
|
||||
|
||||
updatePayload[propKey] = nextProp;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (typeof attributeConfig.process === 'function') {
|
||||
if (!updatePayload) {
|
||||
updatePayload = {};
|
||||
}
|
||||
|
||||
updatePayload[propKey] = attributeConfig.process(nextProp);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (isArray(nextProp)) {
|
||||
for (var i = 0; i < nextProp.length; i++) {
|
||||
updatePayload = fastAddProperties(updatePayload, nextProp[i], attributeConfig);
|
||||
}
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
updatePayload = fastAddProperties(updatePayload, nextProp, attributeConfig);
|
||||
}
|
||||
|
||||
return updatePayload;
|
||||
}
|
||||
/**
|
||||
* addProperties adds all the valid props to the payload after being processed.
|
||||
*/
|
||||
|
||||
|
||||
function addProperties(updatePayload, props, validAttributes) {
|
||||
// TODO: Fast path
|
||||
return diffProperties(updatePayload, emptyObject$1, props, validAttributes);
|
||||
if (enableAddPropertiesFastPath) {
|
||||
return fastAddProperties(updatePayload, props, validAttributes);
|
||||
} else {
|
||||
return diffProperties(updatePayload, emptyObject$1, props, validAttributes);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* clearProperties clears all the previous props by adding a null sentinel
|
||||
@@ -26075,7 +26132,7 @@ identifierPrefix, onUncaughtError, onCaughtError, onRecoverableError, transition
|
||||
return root;
|
||||
}
|
||||
|
||||
var ReactVersion = '19.0.0-beta-197956b7';
|
||||
var ReactVersion = '19.0.0-beta-8a57d9cf';
|
||||
|
||||
/*
|
||||
* The `'' + value` pattern (used in perf-sensitive code) throws for Symbol
|
||||
|
||||
+45
-13
@@ -7,7 +7,7 @@
|
||||
* @noflow
|
||||
* @nolint
|
||||
* @preventMunge
|
||||
* @generated SignedSource<<ad84473bdbce0975ceaaac6469a759ac>>
|
||||
* @generated SignedSource<<97e06df55397eea2903e5bffade5f61e>>
|
||||
*/
|
||||
|
||||
"use strict";
|
||||
@@ -983,6 +983,7 @@ var alwaysThrottleRetries = dynamicFlagsUntyped.alwaysThrottleRetries,
|
||||
dynamicFlagsUntyped.passChildrenWhenCloningPersistedNodes,
|
||||
disableDefaultPropsExceptForClasses =
|
||||
dynamicFlagsUntyped.disableDefaultPropsExceptForClasses,
|
||||
enableAddPropertiesFastPath = dynamicFlagsUntyped.enableAddPropertiesFastPath,
|
||||
emptyObject$1 = {},
|
||||
removedKeys = null,
|
||||
removedKeyCount = 0,
|
||||
@@ -1091,12 +1092,7 @@ function diffNestedProperty(
|
||||
function addNestedProperty(updatePayload, nextProp, validAttributes) {
|
||||
if (!nextProp) return updatePayload;
|
||||
if (!isArrayImpl(nextProp))
|
||||
return diffProperties(
|
||||
updatePayload,
|
||||
emptyObject$1,
|
||||
nextProp,
|
||||
validAttributes
|
||||
);
|
||||
return addProperties(updatePayload, nextProp, validAttributes);
|
||||
for (var i = 0; i < nextProp.length; i++)
|
||||
updatePayload = addNestedProperty(
|
||||
updatePayload,
|
||||
@@ -1206,6 +1202,44 @@ function diffProperties(updatePayload, prevProps, nextProps, validAttributes) {
|
||||
)))));
|
||||
return updatePayload;
|
||||
}
|
||||
function fastAddProperties(updatePayload, nextProps, validAttributes) {
|
||||
var propKey;
|
||||
for (propKey in nextProps) {
|
||||
var nextProp = nextProps[propKey];
|
||||
if (void 0 !== nextProp) {
|
||||
var attributeConfig = validAttributes[propKey];
|
||||
if (void 0 !== attributeConfig)
|
||||
if (
|
||||
("function" === typeof nextProp && (nextProp = !0),
|
||||
"object" !== typeof attributeConfig)
|
||||
)
|
||||
updatePayload || (updatePayload = {}),
|
||||
(updatePayload[propKey] = nextProp);
|
||||
else if ("function" === typeof attributeConfig.process)
|
||||
updatePayload || (updatePayload = {}),
|
||||
(updatePayload[propKey] = attributeConfig.process(nextProp));
|
||||
else if (isArrayImpl(nextProp))
|
||||
for (var i = 0; i < nextProp.length; i++)
|
||||
updatePayload = fastAddProperties(
|
||||
updatePayload,
|
||||
nextProp[i],
|
||||
attributeConfig
|
||||
);
|
||||
else
|
||||
updatePayload = fastAddProperties(
|
||||
updatePayload,
|
||||
nextProp,
|
||||
attributeConfig
|
||||
);
|
||||
}
|
||||
}
|
||||
return updatePayload;
|
||||
}
|
||||
function addProperties(updatePayload, props, validAttributes) {
|
||||
return enableAddPropertiesFastPath
|
||||
? fastAddProperties(updatePayload, props, validAttributes)
|
||||
: diffProperties(updatePayload, emptyObject$1, props, validAttributes);
|
||||
}
|
||||
function batchedUpdatesImpl(fn, bookkeeping) {
|
||||
return fn(bookkeeping);
|
||||
}
|
||||
@@ -1604,9 +1638,8 @@ var scheduleTimeout = setTimeout,
|
||||
cancelTimeout = clearTimeout;
|
||||
function cloneHiddenInstance(instance) {
|
||||
var node = instance.node;
|
||||
var JSCompiler_inline_result = diffProperties(
|
||||
var JSCompiler_inline_result = addProperties(
|
||||
null,
|
||||
emptyObject$1,
|
||||
{ style: { display: "none" } },
|
||||
instance.canonical.viewConfig.validAttributes
|
||||
);
|
||||
@@ -7351,9 +7384,8 @@ function completeWork(current, workInProgress, renderLanes) {
|
||||
current = nextReactTag;
|
||||
nextReactTag += 2;
|
||||
renderLanes = getViewConfigForType(renderLanes);
|
||||
newChildSet = diffProperties(
|
||||
newChildSet = addProperties(
|
||||
null,
|
||||
emptyObject$1,
|
||||
newProps,
|
||||
renderLanes.validAttributes
|
||||
);
|
||||
@@ -10613,7 +10645,7 @@ var roots = new Map(),
|
||||
devToolsConfig$jscomp$inline_1118 = {
|
||||
findFiberByHostInstance: getInstanceFromNode,
|
||||
bundleType: 0,
|
||||
version: "19.0.0-beta-9a489885",
|
||||
version: "19.0.0-beta-5fd3967c",
|
||||
rendererPackageName: "react-native-renderer",
|
||||
rendererConfig: {
|
||||
getInspectorDataForInstance: getInspectorDataForInstance,
|
||||
@@ -10656,7 +10688,7 @@ var internals$jscomp$inline_1385 = {
|
||||
scheduleRoot: null,
|
||||
setRefreshHandler: null,
|
||||
getCurrentFiber: null,
|
||||
reconcilerVersion: "19.0.0-beta-9a489885"
|
||||
reconcilerVersion: "19.0.0-beta-5fd3967c"
|
||||
};
|
||||
if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) {
|
||||
var hook$jscomp$inline_1386 = __REACT_DEVTOOLS_GLOBAL_HOOK__;
|
||||
|
||||
+45
-13
@@ -7,7 +7,7 @@
|
||||
* @noflow
|
||||
* @nolint
|
||||
* @preventMunge
|
||||
* @generated SignedSource<<0cb20923f97d85199b33fe4f36251a51>>
|
||||
* @generated SignedSource<<6a5f873752147d634c1a5052381376b9>>
|
||||
*/
|
||||
|
||||
"use strict";
|
||||
@@ -987,6 +987,7 @@ var alwaysThrottleRetries = dynamicFlagsUntyped.alwaysThrottleRetries,
|
||||
dynamicFlagsUntyped.passChildrenWhenCloningPersistedNodes,
|
||||
disableDefaultPropsExceptForClasses =
|
||||
dynamicFlagsUntyped.disableDefaultPropsExceptForClasses,
|
||||
enableAddPropertiesFastPath = dynamicFlagsUntyped.enableAddPropertiesFastPath,
|
||||
emptyObject$1 = {},
|
||||
removedKeys = null,
|
||||
removedKeyCount = 0,
|
||||
@@ -1095,12 +1096,7 @@ function diffNestedProperty(
|
||||
function addNestedProperty(updatePayload, nextProp, validAttributes) {
|
||||
if (!nextProp) return updatePayload;
|
||||
if (!isArrayImpl(nextProp))
|
||||
return diffProperties(
|
||||
updatePayload,
|
||||
emptyObject$1,
|
||||
nextProp,
|
||||
validAttributes
|
||||
);
|
||||
return addProperties(updatePayload, nextProp, validAttributes);
|
||||
for (var i = 0; i < nextProp.length; i++)
|
||||
updatePayload = addNestedProperty(
|
||||
updatePayload,
|
||||
@@ -1210,6 +1206,44 @@ function diffProperties(updatePayload, prevProps, nextProps, validAttributes) {
|
||||
)))));
|
||||
return updatePayload;
|
||||
}
|
||||
function fastAddProperties(updatePayload, nextProps, validAttributes) {
|
||||
var propKey;
|
||||
for (propKey in nextProps) {
|
||||
var nextProp = nextProps[propKey];
|
||||
if (void 0 !== nextProp) {
|
||||
var attributeConfig = validAttributes[propKey];
|
||||
if (void 0 !== attributeConfig)
|
||||
if (
|
||||
("function" === typeof nextProp && (nextProp = !0),
|
||||
"object" !== typeof attributeConfig)
|
||||
)
|
||||
updatePayload || (updatePayload = {}),
|
||||
(updatePayload[propKey] = nextProp);
|
||||
else if ("function" === typeof attributeConfig.process)
|
||||
updatePayload || (updatePayload = {}),
|
||||
(updatePayload[propKey] = attributeConfig.process(nextProp));
|
||||
else if (isArrayImpl(nextProp))
|
||||
for (var i = 0; i < nextProp.length; i++)
|
||||
updatePayload = fastAddProperties(
|
||||
updatePayload,
|
||||
nextProp[i],
|
||||
attributeConfig
|
||||
);
|
||||
else
|
||||
updatePayload = fastAddProperties(
|
||||
updatePayload,
|
||||
nextProp,
|
||||
attributeConfig
|
||||
);
|
||||
}
|
||||
}
|
||||
return updatePayload;
|
||||
}
|
||||
function addProperties(updatePayload, props, validAttributes) {
|
||||
return enableAddPropertiesFastPath
|
||||
? fastAddProperties(updatePayload, props, validAttributes)
|
||||
: diffProperties(updatePayload, emptyObject$1, props, validAttributes);
|
||||
}
|
||||
function batchedUpdatesImpl(fn, bookkeeping) {
|
||||
return fn(bookkeeping);
|
||||
}
|
||||
@@ -1726,9 +1760,8 @@ var scheduleTimeout = setTimeout,
|
||||
cancelTimeout = clearTimeout;
|
||||
function cloneHiddenInstance(instance) {
|
||||
var node = instance.node;
|
||||
var JSCompiler_inline_result = diffProperties(
|
||||
var JSCompiler_inline_result = addProperties(
|
||||
null,
|
||||
emptyObject$1,
|
||||
{ style: { display: "none" } },
|
||||
instance.canonical.viewConfig.validAttributes
|
||||
);
|
||||
@@ -7617,9 +7650,8 @@ function completeWork(current, workInProgress, renderLanes) {
|
||||
current = nextReactTag;
|
||||
nextReactTag += 2;
|
||||
renderLanes = getViewConfigForType(renderLanes);
|
||||
newChildSet = diffProperties(
|
||||
newChildSet = addProperties(
|
||||
null,
|
||||
emptyObject$1,
|
||||
newProps,
|
||||
renderLanes.validAttributes
|
||||
);
|
||||
@@ -11318,7 +11350,7 @@ var roots = new Map(),
|
||||
devToolsConfig$jscomp$inline_1198 = {
|
||||
findFiberByHostInstance: getInstanceFromNode,
|
||||
bundleType: 0,
|
||||
version: "19.0.0-beta-781ecc88",
|
||||
version: "19.0.0-beta-87fa5d3f",
|
||||
rendererPackageName: "react-native-renderer",
|
||||
rendererConfig: {
|
||||
getInspectorDataForInstance: getInspectorDataForInstance,
|
||||
@@ -11374,7 +11406,7 @@ var roots = new Map(),
|
||||
scheduleRoot: null,
|
||||
setRefreshHandler: null,
|
||||
getCurrentFiber: null,
|
||||
reconcilerVersion: "19.0.0-beta-781ecc88"
|
||||
reconcilerVersion: "19.0.0-beta-87fa5d3f"
|
||||
});
|
||||
exports.createPortal = function (children, containerTag) {
|
||||
return createPortal$1(
|
||||
|
||||
+62
-5
@@ -7,7 +7,7 @@
|
||||
* @noflow
|
||||
* @nolint
|
||||
* @preventMunge
|
||||
* @generated SignedSource<<d0205c5405c0a28da5aef95cacca169a>>
|
||||
* @generated SignedSource<<bedf6c7a6f00f33bfdcba4960c3569a5>>
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
@@ -2350,7 +2350,8 @@ var alwaysThrottleRetries = dynamicFlags.alwaysThrottleRetries,
|
||||
enableRenderableContext = dynamicFlags.enableRenderableContext,
|
||||
enableUnifiedSyncLane = dynamicFlags.enableUnifiedSyncLane,
|
||||
useModernStrictMode = dynamicFlags.useModernStrictMode,
|
||||
disableDefaultPropsExceptForClasses = dynamicFlags.disableDefaultPropsExceptForClasses; // The rest of the flags are static for better dead code elimination.
|
||||
disableDefaultPropsExceptForClasses = dynamicFlags.disableDefaultPropsExceptForClasses,
|
||||
enableAddPropertiesFastPath = dynamicFlags.enableAddPropertiesFastPath; // The rest of the flags are static for better dead code elimination.
|
||||
var enableSchedulingProfiler = true;
|
||||
var enableProfilerTimer = true;
|
||||
var enableProfilerCommitHooks = true;
|
||||
@@ -3382,14 +3383,70 @@ function diffProperties(updatePayload, prevProps, nextProps, validAttributes) {
|
||||
|
||||
return updatePayload;
|
||||
}
|
||||
|
||||
function fastAddProperties(updatePayload, nextProps, validAttributes) {
|
||||
var attributeConfig;
|
||||
var nextProp;
|
||||
|
||||
for (var propKey in nextProps) {
|
||||
nextProp = nextProps[propKey];
|
||||
|
||||
if (nextProp === undefined) {
|
||||
continue;
|
||||
}
|
||||
|
||||
attributeConfig = validAttributes[propKey];
|
||||
|
||||
if (attributeConfig === undefined) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (typeof nextProp === 'function') {
|
||||
nextProp = true;
|
||||
}
|
||||
|
||||
if (typeof attributeConfig !== 'object') {
|
||||
if (!updatePayload) {
|
||||
updatePayload = {};
|
||||
}
|
||||
|
||||
updatePayload[propKey] = nextProp;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (typeof attributeConfig.process === 'function') {
|
||||
if (!updatePayload) {
|
||||
updatePayload = {};
|
||||
}
|
||||
|
||||
updatePayload[propKey] = attributeConfig.process(nextProp);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (isArray(nextProp)) {
|
||||
for (var i = 0; i < nextProp.length; i++) {
|
||||
updatePayload = fastAddProperties(updatePayload, nextProp[i], attributeConfig);
|
||||
}
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
updatePayload = fastAddProperties(updatePayload, nextProp, attributeConfig);
|
||||
}
|
||||
|
||||
return updatePayload;
|
||||
}
|
||||
/**
|
||||
* addProperties adds all the valid props to the payload after being processed.
|
||||
*/
|
||||
|
||||
|
||||
function addProperties(updatePayload, props, validAttributes) {
|
||||
// TODO: Fast path
|
||||
return diffProperties(updatePayload, emptyObject$1, props, validAttributes);
|
||||
if (enableAddPropertiesFastPath) {
|
||||
return fastAddProperties(updatePayload, props, validAttributes);
|
||||
} else {
|
||||
return diffProperties(updatePayload, emptyObject$1, props, validAttributes);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* clearProperties clears all the previous props by adding a null sentinel
|
||||
@@ -26487,7 +26544,7 @@ identifierPrefix, onUncaughtError, onCaughtError, onRecoverableError, transition
|
||||
return root;
|
||||
}
|
||||
|
||||
var ReactVersion = '19.0.0-beta-0126d00e';
|
||||
var ReactVersion = '19.0.0-beta-f77489ba';
|
||||
|
||||
/*
|
||||
* The `'' + value` pattern (used in perf-sensitive code) throws for Symbol
|
||||
|
||||
+46
-19
@@ -7,7 +7,7 @@
|
||||
* @noflow
|
||||
* @nolint
|
||||
* @preventMunge
|
||||
* @generated SignedSource<<29b6d6559ba3d8f7ff9f1592b99ed8f4>>
|
||||
* @generated SignedSource<<2f2f979409296aff4c730c9db543982b>>
|
||||
*/
|
||||
|
||||
"use strict";
|
||||
@@ -1126,6 +1126,7 @@ var alwaysThrottleRetries = dynamicFlagsUntyped.alwaysThrottleRetries,
|
||||
enableUnifiedSyncLane = dynamicFlagsUntyped.enableUnifiedSyncLane,
|
||||
disableDefaultPropsExceptForClasses =
|
||||
dynamicFlagsUntyped.disableDefaultPropsExceptForClasses,
|
||||
enableAddPropertiesFastPath = dynamicFlagsUntyped.enableAddPropertiesFastPath,
|
||||
REACT_LEGACY_ELEMENT_TYPE = Symbol.for("react.element"),
|
||||
REACT_PORTAL_TYPE = Symbol.for("react.portal"),
|
||||
REACT_FRAGMENT_TYPE = Symbol.for("react.fragment"),
|
||||
@@ -1492,12 +1493,7 @@ function diffNestedProperty(
|
||||
function addNestedProperty(updatePayload, nextProp, validAttributes) {
|
||||
if (!nextProp) return updatePayload;
|
||||
if (!isArrayImpl(nextProp))
|
||||
return diffProperties(
|
||||
updatePayload,
|
||||
emptyObject$1,
|
||||
nextProp,
|
||||
validAttributes
|
||||
);
|
||||
return addProperties(updatePayload, nextProp, validAttributes);
|
||||
for (var i = 0; i < nextProp.length; i++)
|
||||
updatePayload = addNestedProperty(
|
||||
updatePayload,
|
||||
@@ -1607,6 +1603,44 @@ function diffProperties(updatePayload, prevProps, nextProps, validAttributes) {
|
||||
)))));
|
||||
return updatePayload;
|
||||
}
|
||||
function fastAddProperties(updatePayload, nextProps, validAttributes) {
|
||||
var propKey;
|
||||
for (propKey in nextProps) {
|
||||
var nextProp = nextProps[propKey];
|
||||
if (void 0 !== nextProp) {
|
||||
var attributeConfig = validAttributes[propKey];
|
||||
if (void 0 !== attributeConfig)
|
||||
if (
|
||||
("function" === typeof nextProp && (nextProp = !0),
|
||||
"object" !== typeof attributeConfig)
|
||||
)
|
||||
updatePayload || (updatePayload = {}),
|
||||
(updatePayload[propKey] = nextProp);
|
||||
else if ("function" === typeof attributeConfig.process)
|
||||
updatePayload || (updatePayload = {}),
|
||||
(updatePayload[propKey] = attributeConfig.process(nextProp));
|
||||
else if (isArrayImpl(nextProp))
|
||||
for (var i = 0; i < nextProp.length; i++)
|
||||
updatePayload = fastAddProperties(
|
||||
updatePayload,
|
||||
nextProp[i],
|
||||
attributeConfig
|
||||
);
|
||||
else
|
||||
updatePayload = fastAddProperties(
|
||||
updatePayload,
|
||||
nextProp,
|
||||
attributeConfig
|
||||
);
|
||||
}
|
||||
}
|
||||
return updatePayload;
|
||||
}
|
||||
function addProperties(updatePayload, props, validAttributes) {
|
||||
return enableAddPropertiesFastPath
|
||||
? fastAddProperties(updatePayload, props, validAttributes)
|
||||
: diffProperties(updatePayload, emptyObject$1, props, validAttributes);
|
||||
}
|
||||
function mountSafeCallback_NOT_REALLY_SAFE(context, callback) {
|
||||
return function () {
|
||||
if (
|
||||
@@ -1657,9 +1691,8 @@ var ReactNativeFiberHostComponent = (function () {
|
||||
);
|
||||
};
|
||||
_proto.setNativeProps = function (nativeProps) {
|
||||
nativeProps = diffProperties(
|
||||
nativeProps = addProperties(
|
||||
null,
|
||||
emptyObject$1,
|
||||
nativeProps,
|
||||
this.viewConfig.validAttributes
|
||||
);
|
||||
@@ -7238,12 +7271,7 @@ function completeWork(current, workInProgress, renderLanes) {
|
||||
renderLanes = rootInstanceStackCursor.current;
|
||||
current = allocateTag();
|
||||
type = getViewConfigForType(type);
|
||||
var updatePayload = diffProperties(
|
||||
null,
|
||||
emptyObject$1,
|
||||
newProps,
|
||||
type.validAttributes
|
||||
);
|
||||
var updatePayload = addProperties(null, newProps, type.validAttributes);
|
||||
ReactNativePrivateInterface.UIManager.createView(
|
||||
current,
|
||||
type.uiViewClassName,
|
||||
@@ -8455,9 +8483,8 @@ function commitMutationEffectsOnFiber(finishedWork, root) {
|
||||
try {
|
||||
if (((newProps = root.stateNode), viewConfig)) {
|
||||
var viewConfig$jscomp$0 = newProps.viewConfig;
|
||||
var updatePayload$jscomp$0 = diffProperties(
|
||||
var updatePayload$jscomp$0 = addProperties(
|
||||
null,
|
||||
emptyObject$1,
|
||||
{ style: { display: "none" } },
|
||||
viewConfig$jscomp$0.validAttributes
|
||||
);
|
||||
@@ -10834,7 +10861,7 @@ var roots = new Map(),
|
||||
devToolsConfig$jscomp$inline_1186 = {
|
||||
findFiberByHostInstance: getInstanceFromTag,
|
||||
bundleType: 0,
|
||||
version: "19.0.0-beta-8879f21c",
|
||||
version: "19.0.0-beta-7054616c",
|
||||
rendererPackageName: "react-native-renderer",
|
||||
rendererConfig: {
|
||||
getInspectorDataForInstance: getInspectorDataForInstance,
|
||||
@@ -10877,7 +10904,7 @@ var internals$jscomp$inline_1470 = {
|
||||
scheduleRoot: null,
|
||||
setRefreshHandler: null,
|
||||
getCurrentFiber: null,
|
||||
reconcilerVersion: "19.0.0-beta-8879f21c"
|
||||
reconcilerVersion: "19.0.0-beta-7054616c"
|
||||
};
|
||||
if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) {
|
||||
var hook$jscomp$inline_1471 = __REACT_DEVTOOLS_GLOBAL_HOOK__;
|
||||
|
||||
+46
-19
@@ -7,7 +7,7 @@
|
||||
* @noflow
|
||||
* @nolint
|
||||
* @preventMunge
|
||||
* @generated SignedSource<<06820f12c0e85d0af8fe960e3776ec34>>
|
||||
* @generated SignedSource<<a15721f6aa7972d4b9e01678b2afe90a>>
|
||||
*/
|
||||
|
||||
"use strict";
|
||||
@@ -1130,6 +1130,7 @@ var alwaysThrottleRetries = dynamicFlagsUntyped.alwaysThrottleRetries,
|
||||
enableUnifiedSyncLane = dynamicFlagsUntyped.enableUnifiedSyncLane,
|
||||
disableDefaultPropsExceptForClasses =
|
||||
dynamicFlagsUntyped.disableDefaultPropsExceptForClasses,
|
||||
enableAddPropertiesFastPath = dynamicFlagsUntyped.enableAddPropertiesFastPath,
|
||||
REACT_LEGACY_ELEMENT_TYPE = Symbol.for("react.element"),
|
||||
REACT_PORTAL_TYPE = Symbol.for("react.portal"),
|
||||
REACT_FRAGMENT_TYPE = Symbol.for("react.fragment"),
|
||||
@@ -1496,12 +1497,7 @@ function diffNestedProperty(
|
||||
function addNestedProperty(updatePayload, nextProp, validAttributes) {
|
||||
if (!nextProp) return updatePayload;
|
||||
if (!isArrayImpl(nextProp))
|
||||
return diffProperties(
|
||||
updatePayload,
|
||||
emptyObject$1,
|
||||
nextProp,
|
||||
validAttributes
|
||||
);
|
||||
return addProperties(updatePayload, nextProp, validAttributes);
|
||||
for (var i = 0; i < nextProp.length; i++)
|
||||
updatePayload = addNestedProperty(
|
||||
updatePayload,
|
||||
@@ -1611,6 +1607,44 @@ function diffProperties(updatePayload, prevProps, nextProps, validAttributes) {
|
||||
)))));
|
||||
return updatePayload;
|
||||
}
|
||||
function fastAddProperties(updatePayload, nextProps, validAttributes) {
|
||||
var propKey;
|
||||
for (propKey in nextProps) {
|
||||
var nextProp = nextProps[propKey];
|
||||
if (void 0 !== nextProp) {
|
||||
var attributeConfig = validAttributes[propKey];
|
||||
if (void 0 !== attributeConfig)
|
||||
if (
|
||||
("function" === typeof nextProp && (nextProp = !0),
|
||||
"object" !== typeof attributeConfig)
|
||||
)
|
||||
updatePayload || (updatePayload = {}),
|
||||
(updatePayload[propKey] = nextProp);
|
||||
else if ("function" === typeof attributeConfig.process)
|
||||
updatePayload || (updatePayload = {}),
|
||||
(updatePayload[propKey] = attributeConfig.process(nextProp));
|
||||
else if (isArrayImpl(nextProp))
|
||||
for (var i = 0; i < nextProp.length; i++)
|
||||
updatePayload = fastAddProperties(
|
||||
updatePayload,
|
||||
nextProp[i],
|
||||
attributeConfig
|
||||
);
|
||||
else
|
||||
updatePayload = fastAddProperties(
|
||||
updatePayload,
|
||||
nextProp,
|
||||
attributeConfig
|
||||
);
|
||||
}
|
||||
}
|
||||
return updatePayload;
|
||||
}
|
||||
function addProperties(updatePayload, props, validAttributes) {
|
||||
return enableAddPropertiesFastPath
|
||||
? fastAddProperties(updatePayload, props, validAttributes)
|
||||
: diffProperties(updatePayload, emptyObject$1, props, validAttributes);
|
||||
}
|
||||
function mountSafeCallback_NOT_REALLY_SAFE(context, callback) {
|
||||
return function () {
|
||||
if (
|
||||
@@ -1661,9 +1695,8 @@ var ReactNativeFiberHostComponent = (function () {
|
||||
);
|
||||
};
|
||||
_proto.setNativeProps = function (nativeProps) {
|
||||
nativeProps = diffProperties(
|
||||
nativeProps = addProperties(
|
||||
null,
|
||||
emptyObject$1,
|
||||
nativeProps,
|
||||
this.viewConfig.validAttributes
|
||||
);
|
||||
@@ -7504,12 +7537,7 @@ function completeWork(current, workInProgress, renderLanes) {
|
||||
renderLanes = rootInstanceStackCursor.current;
|
||||
current = allocateTag();
|
||||
type = getViewConfigForType(type);
|
||||
var updatePayload = diffProperties(
|
||||
null,
|
||||
emptyObject$1,
|
||||
newProps,
|
||||
type.validAttributes
|
||||
);
|
||||
var updatePayload = addProperties(null, newProps, type.validAttributes);
|
||||
ReactNativePrivateInterface.UIManager.createView(
|
||||
current,
|
||||
type.uiViewClassName,
|
||||
@@ -8938,9 +8966,8 @@ function commitMutationEffectsOnFiber(finishedWork, root) {
|
||||
try {
|
||||
if (((newProps = root.stateNode), viewConfig)) {
|
||||
var viewConfig$jscomp$0 = newProps.viewConfig;
|
||||
var updatePayload$jscomp$0 = diffProperties(
|
||||
var updatePayload$jscomp$0 = addProperties(
|
||||
null,
|
||||
emptyObject$1,
|
||||
{ style: { display: "none" } },
|
||||
viewConfig$jscomp$0.validAttributes
|
||||
);
|
||||
@@ -11540,7 +11567,7 @@ var roots = new Map(),
|
||||
devToolsConfig$jscomp$inline_1266 = {
|
||||
findFiberByHostInstance: getInstanceFromTag,
|
||||
bundleType: 0,
|
||||
version: "19.0.0-beta-2ba13034",
|
||||
version: "19.0.0-beta-650dcd3b",
|
||||
rendererPackageName: "react-native-renderer",
|
||||
rendererConfig: {
|
||||
getInspectorDataForInstance: getInspectorDataForInstance,
|
||||
@@ -11596,7 +11623,7 @@ var roots = new Map(),
|
||||
scheduleRoot: null,
|
||||
setRefreshHandler: null,
|
||||
getCurrentFiber: null,
|
||||
reconcilerVersion: "19.0.0-beta-2ba13034"
|
||||
reconcilerVersion: "19.0.0-beta-650dcd3b"
|
||||
});
|
||||
exports.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED = {
|
||||
computeComponentStackForErrorReporting: function (reactTag) {
|
||||
|
||||
Reference in New Issue
Block a user