Skip to content

Commit fe57019

Browse files
committed
Configure "Always On" Feature Flags for React Native (#28519)
## Summary This PR is a subset of #28425, which only includes the feature flags that will be configured as "always on" (i.e. not "dynamic"). The following list summarizes the feature flag changes: * RN FB * Always Enable * enableCache * enableCustomElementPropertySupport * RN OSS * Always Enable * disableLegacyContext * enableCache * enableCustomElementPropertySupport * RN Test * Always Enable * disableModulePatternComponents * enableCustomElementPropertySupport ## How did you test this change? Ran the following successfully: ``` $ yarn test $ yarn flow native $ yarn flow fabric ``` DiffTrain build for commit 4e2fe10.
1 parent a67aa55 commit fe57019

File tree

15 files changed

+5421
-1646
lines changed

15 files changed

+5421
-1646
lines changed

compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react-test-renderer/cjs/ReactTestRenderer-dev.js

Lines changed: 3 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* @noflow
88
* @nolint
99
* @preventMunge
10-
* @generated SignedSource<<85c861db7cfef261bb2c4cf3c4163b32>>
10+
* @generated SignedSource<<db79d0fa61da74ae92c8d9795516873a>>
1111
*/
1212

1313
"use strict";
@@ -13887,66 +13887,7 @@ if (__DEV__) {
1388713887
}
1388813888
}
1388913889

13890-
if (
13891-
// Run these checks in production only if the flag is off.
13892-
// Eventually we'll delete this branch altogether.
13893-
typeof value === "object" &&
13894-
value !== null &&
13895-
typeof value.render === "function" &&
13896-
value.$$typeof === undefined
13897-
) {
13898-
{
13899-
var _componentName2 =
13900-
getComponentNameFromType(Component) || "Unknown";
13901-
13902-
if (!didWarnAboutModulePatternComponent[_componentName2]) {
13903-
error(
13904-
"The <%s /> component appears to be a function component that returns a class instance. " +
13905-
"Change %s to a class that extends React.Component instead. " +
13906-
"If you can't use a class try assigning the prototype on the function as a workaround. " +
13907-
"`%s.prototype = React.Component.prototype`. Don't use an arrow function since it " +
13908-
"cannot be called with `new` by React.",
13909-
_componentName2,
13910-
_componentName2,
13911-
_componentName2
13912-
);
13913-
13914-
didWarnAboutModulePatternComponent[_componentName2] = true;
13915-
}
13916-
} // Proceed under the assumption that this is a class instance
13917-
13918-
workInProgress.tag = ClassComponent; // Throw out any hooks that were used.
13919-
13920-
workInProgress.memoizedState = null;
13921-
workInProgress.updateQueue = null; // Push context providers early to prevent context stack mismatches.
13922-
// During mounting we don't know the child context yet as the instance doesn't exist.
13923-
// We will invalidate the child context in finishClassComponent() right after rendering.
13924-
13925-
var hasContext = false;
13926-
13927-
if (isContextProvider(Component)) {
13928-
hasContext = true;
13929-
pushContextProvider(workInProgress);
13930-
} else {
13931-
hasContext = false;
13932-
}
13933-
13934-
workInProgress.memoizedState =
13935-
value.state !== null && value.state !== undefined
13936-
? value.state
13937-
: null;
13938-
initializeUpdateQueue(workInProgress);
13939-
adoptClassInstance(workInProgress, value);
13940-
mountClassInstance(workInProgress, Component, props, renderLanes);
13941-
return finishClassComponent(
13942-
null,
13943-
workInProgress,
13944-
Component,
13945-
true,
13946-
hasContext,
13947-
renderLanes
13948-
);
13949-
} else {
13890+
{
1395013891
// Proceed under the assumption that this is a function component
1395113892
workInProgress.tag = FunctionComponent;
1395213893

@@ -25736,7 +25677,7 @@ if (__DEV__) {
2573625677
return root;
2573725678
}
2573825679

25739-
var ReactVersion = "18.3.0-canary-338dddc08-20240307";
25680+
var ReactVersion = "18.3.0-canary-4e2fe10fa-20240308";
2574025681

2574125682
// Might add PROFILE later.
2574225683

compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react-test-renderer/cjs/ReactTestRenderer-prod.js

Lines changed: 36 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* @noflow
88
* @nolint
99
* @preventMunge
10-
* @generated SignedSource<<0b3d2b1f18482dd826567f1832971cb5>>
10+
* @generated SignedSource<<0327ee67e8b4e0b45068a1c519910784>>
1111
*/
1212

1313
"use strict";
@@ -8070,7 +8070,7 @@ beginWork = function (current, workInProgress, renderLanes) {
80708070
contextStackCursor$1.current
80718071
);
80728072
prepareToReadContext(workInProgress, renderLanes);
8073-
context = renderWithHooks(
8073+
current = renderWithHooks(
80748074
null,
80758075
workInProgress,
80768076
Component,
@@ -8079,40 +8079,9 @@ beginWork = function (current, workInProgress, renderLanes) {
80798079
renderLanes
80808080
);
80818081
workInProgress.flags |= 1;
8082-
if (
8083-
"object" === typeof context &&
8084-
null !== context &&
8085-
"function" === typeof context.render &&
8086-
void 0 === context.$$typeof
8087-
) {
8088-
workInProgress.tag = 1;
8089-
workInProgress.memoizedState = null;
8090-
workInProgress.updateQueue = null;
8091-
if (isContextProvider(Component)) {
8092-
var hasContext = !0;
8093-
pushContextProvider(workInProgress);
8094-
} else hasContext = !1;
8095-
workInProgress.memoizedState =
8096-
null !== context.state && void 0 !== context.state
8097-
? context.state
8098-
: null;
8099-
initializeUpdateQueue(workInProgress);
8100-
context.updater = classComponentUpdater;
8101-
workInProgress.stateNode = context;
8102-
context._reactInternals = workInProgress;
8103-
mountClassInstance(workInProgress, Component, current, renderLanes);
8104-
workInProgress = finishClassComponent(
8105-
null,
8106-
workInProgress,
8107-
Component,
8108-
!0,
8109-
hasContext,
8110-
renderLanes
8111-
);
8112-
} else
8113-
(workInProgress.tag = 0),
8114-
reconcileChildren(null, workInProgress, context, renderLanes),
8115-
(workInProgress = workInProgress.child);
8082+
workInProgress.tag = 0;
8083+
reconcileChildren(null, workInProgress, current, renderLanes);
8084+
workInProgress = workInProgress.child;
81168085
return workInProgress;
81178086
case 16:
81188087
Component = workInProgress.elementType;
@@ -8205,18 +8174,18 @@ beginWork = function (current, workInProgress, renderLanes) {
82058174
pushHostRootContext(workInProgress);
82068175
if (null === current)
82078176
throw Error("Should have a current fiber. This is a bug in React.");
8208-
hasContext = workInProgress.pendingProps;
8177+
var nextProps = workInProgress.pendingProps;
82098178
context = workInProgress.memoizedState;
82108179
Component = context.element;
82118180
cloneUpdateQueue(current, workInProgress);
8212-
processUpdateQueue(workInProgress, hasContext, null, renderLanes);
8213-
hasContext = workInProgress.memoizedState;
8214-
var nextCache = hasContext.cache;
8181+
processUpdateQueue(workInProgress, nextProps, null, renderLanes);
8182+
nextProps = workInProgress.memoizedState;
8183+
var nextCache = nextProps.cache;
82158184
pushProvider(workInProgress, CacheContext, nextCache);
82168185
nextCache !== context.cache &&
82178186
propagateContextChange(workInProgress, CacheContext, renderLanes);
82188187
suspendIfUpdateReadFromEntangledAsyncAction();
8219-
context = hasContext.element;
8188+
context = nextProps.element;
82208189
context === Component
82218190
? (workInProgress = bailoutOnAlreadyFinishedWork(
82228191
current,
@@ -8325,13 +8294,13 @@ beginWork = function (current, workInProgress, renderLanes) {
83258294
a: {
83268295
Component = workInProgress.type._context;
83278296
context = workInProgress.pendingProps;
8328-
hasContext = workInProgress.memoizedProps;
8297+
nextProps = workInProgress.memoizedProps;
83298298
nextCache = context.value;
83308299
pushProvider(workInProgress, Component, nextCache);
8331-
if (null !== hasContext)
8332-
if (objectIs(hasContext.value, nextCache)) {
8300+
if (null !== nextProps)
8301+
if (objectIs(nextProps.value, nextCache)) {
83338302
if (
8334-
hasContext.children === context.children &&
8303+
nextProps.children === context.children &&
83358304
!didPerformWorkStackCursor.current
83368305
) {
83378306
workInProgress = bailoutOnAlreadyFinishedWork(
@@ -8420,11 +8389,11 @@ beginWork = function (current, workInProgress, renderLanes) {
84208389
? ((context = peekCacheFromPool()),
84218390
null === context &&
84228391
((context = workInProgressRoot),
8423-
(hasContext = createCache()),
8424-
(context.pooledCache = hasContext),
8425-
hasContext.refCount++,
8426-
null !== hasContext && (context.pooledCacheLanes |= renderLanes),
8427-
(context = hasContext)),
8392+
(nextProps = createCache()),
8393+
(context.pooledCache = nextProps),
8394+
nextProps.refCount++,
8395+
null !== nextProps && (context.pooledCacheLanes |= renderLanes),
8396+
(context = nextProps)),
84288397
(workInProgress.memoizedState = {
84298398
parent: Component,
84308399
cache: context
@@ -8436,7 +8405,7 @@ beginWork = function (current, workInProgress, renderLanes) {
84368405
processUpdateQueue(workInProgress, null, null, renderLanes),
84378406
suspendIfUpdateReadFromEntangledAsyncAction()),
84388407
(context = current.memoizedState),
8439-
(hasContext = workInProgress.memoizedState),
8408+
(nextProps = workInProgress.memoizedState),
84408409
context.parent !== Component
84418410
? ((context = { parent: Component, cache: Component }),
84428411
(workInProgress.memoizedState = context),
@@ -8445,7 +8414,7 @@ beginWork = function (current, workInProgress, renderLanes) {
84458414
workInProgress.updateQueue.baseState =
84468415
context),
84478416
pushProvider(workInProgress, CacheContext, Component))
8448-
: ((Component = hasContext.cache),
8417+
: ((Component = nextProps.cache),
84498418
pushProvider(workInProgress, CacheContext, Component),
84508419
Component !== context.cache &&
84518420
propagateContextChange(
@@ -9173,19 +9142,19 @@ function wrapFiber(fiber) {
91739142
fiberToWrapper.set(fiber, wrapper));
91749143
return wrapper;
91759144
}
9176-
var devToolsConfig$jscomp$inline_1014 = {
9145+
var devToolsConfig$jscomp$inline_1016 = {
91779146
findFiberByHostInstance: function () {
91789147
throw Error("TestRenderer does not support findFiberByHostInstance()");
91799148
},
91809149
bundleType: 0,
9181-
version: "18.3.0-canary-338dddc08-20240307",
9150+
version: "18.3.0-canary-4e2fe10fa-20240308",
91829151
rendererPackageName: "react-test-renderer"
91839152
};
9184-
var internals$jscomp$inline_1195 = {
9185-
bundleType: devToolsConfig$jscomp$inline_1014.bundleType,
9186-
version: devToolsConfig$jscomp$inline_1014.version,
9187-
rendererPackageName: devToolsConfig$jscomp$inline_1014.rendererPackageName,
9188-
rendererConfig: devToolsConfig$jscomp$inline_1014.rendererConfig,
9153+
var internals$jscomp$inline_1194 = {
9154+
bundleType: devToolsConfig$jscomp$inline_1016.bundleType,
9155+
version: devToolsConfig$jscomp$inline_1016.version,
9156+
rendererPackageName: devToolsConfig$jscomp$inline_1016.rendererPackageName,
9157+
rendererConfig: devToolsConfig$jscomp$inline_1016.rendererConfig,
91899158
overrideHookState: null,
91909159
overrideHookStateDeletePath: null,
91919160
overrideHookStateRenamePath: null,
@@ -9202,26 +9171,26 @@ var internals$jscomp$inline_1195 = {
92029171
return null === fiber ? null : fiber.stateNode;
92039172
},
92049173
findFiberByHostInstance:
9205-
devToolsConfig$jscomp$inline_1014.findFiberByHostInstance ||
9174+
devToolsConfig$jscomp$inline_1016.findFiberByHostInstance ||
92069175
emptyFindFiberByHostInstance,
92079176
findHostInstancesForRefresh: null,
92089177
scheduleRefresh: null,
92099178
scheduleRoot: null,
92109179
setRefreshHandler: null,
92119180
getCurrentFiber: null,
9212-
reconcilerVersion: "18.3.0-canary-338dddc08-20240307"
9181+
reconcilerVersion: "18.3.0-canary-4e2fe10fa-20240308"
92139182
};
92149183
if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) {
9215-
var hook$jscomp$inline_1196 = __REACT_DEVTOOLS_GLOBAL_HOOK__;
9184+
var hook$jscomp$inline_1195 = __REACT_DEVTOOLS_GLOBAL_HOOK__;
92169185
if (
9217-
!hook$jscomp$inline_1196.isDisabled &&
9218-
hook$jscomp$inline_1196.supportsFiber
9186+
!hook$jscomp$inline_1195.isDisabled &&
9187+
hook$jscomp$inline_1195.supportsFiber
92199188
)
92209189
try {
9221-
(rendererID = hook$jscomp$inline_1196.inject(
9222-
internals$jscomp$inline_1195
9190+
(rendererID = hook$jscomp$inline_1195.inject(
9191+
internals$jscomp$inline_1194
92239192
)),
9224-
(injectedHook = hook$jscomp$inline_1196);
9193+
(injectedHook = hook$jscomp$inline_1195);
92259194
} catch (err) {}
92269195
}
92279196
exports._Scheduler = Scheduler;

0 commit comments

Comments
 (0)