Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,6 @@ describe('ReactFabric', () => {
expect(nativeFabricUIManager.completeRoot).toBeCalled();
});

// @gate enablePersistedModeClonedFlag
it('should not clone nodes when layout effects are used', async () => {
const View = createReactNativeComponentClass('RCTView', () => ({
validAttributes: {foo: true},
Expand All @@ -305,6 +304,8 @@ describe('ReactFabric', () => {
<ComponentWithEffect />
</View>,
11,
null,
true,
),
);
expect(nativeFabricUIManager.completeRoot).toBeCalled();
Expand All @@ -316,6 +317,8 @@ describe('ReactFabric', () => {
<ComponentWithEffect />
</View>,
11,
null,
true,
),
);
expect(nativeFabricUIManager.cloneNode).not.toBeCalled();
Expand All @@ -327,7 +330,6 @@ describe('ReactFabric', () => {
expect(nativeFabricUIManager.completeRoot).not.toBeCalled();
});

// @gate enablePersistedModeClonedFlag
it('should not clone nodes when insertion effects are used', async () => {
const View = createReactNativeComponentClass('RCTView', () => ({
validAttributes: {foo: true},
Expand All @@ -345,6 +347,8 @@ describe('ReactFabric', () => {
<ComponentWithRef />
</View>,
11,
null,
true,
),
);
expect(nativeFabricUIManager.completeRoot).toBeCalled();
Expand All @@ -356,6 +360,8 @@ describe('ReactFabric', () => {
<ComponentWithRef />
</View>,
11,
null,
true,
),
);
expect(nativeFabricUIManager.cloneNode).not.toBeCalled();
Expand All @@ -367,7 +373,6 @@ describe('ReactFabric', () => {
expect(nativeFabricUIManager.completeRoot).not.toBeCalled();
});

// @gate enablePersistedModeClonedFlag
it('should not clone nodes when useImperativeHandle is used', async () => {
const View = createReactNativeComponentClass('RCTView', () => ({
validAttributes: {foo: true},
Expand All @@ -387,6 +392,8 @@ describe('ReactFabric', () => {
<ComponentWithImperativeHandle ref={ref} />
</View>,
11,
null,
true,
),
);
expect(nativeFabricUIManager.completeRoot).toBeCalled();
Expand All @@ -399,6 +406,8 @@ describe('ReactFabric', () => {
<ComponentWithImperativeHandle ref={ref} />
</View>,
11,
null,
true,
),
);
expect(nativeFabricUIManager.cloneNode).not.toBeCalled();
Expand Down
6 changes: 1 addition & 5 deletions packages/react-reconciler/src/ReactFiberCommitWork.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ import {
alwaysThrottleRetries,
enableCreateEventHandleAPI,
enableHiddenSubtreeInsertionEffectCleanup,
enablePersistedModeClonedFlag,
enableProfilerTimer,
enableProfilerCommitHooks,
enableSuspenseCallback,
Expand Down Expand Up @@ -1969,10 +1968,7 @@ function recursivelyTraverseMutationEffects(
}
}

if (
parentFiber.subtreeFlags &
(enablePersistedModeClonedFlag ? MutationMask | Cloned : MutationMask)
) {
if (parentFiber.subtreeFlags & (MutationMask | Cloned)) {
let child = parentFiber.child;
while (child !== null) {
commitMutationEffectsOnFiber(child, root, lanes);
Expand Down
26 changes: 5 additions & 21 deletions packages/react-reconciler/src/ReactFiberCompleteWork.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ import {
enableLegacyHidden,
enableSuspenseCallback,
enableScopeAPI,
enablePersistedModeClonedFlag,
enableProfilerTimer,
enableTransitionTracing,
passChildrenWhenCloningPersistedNodes,
Expand Down Expand Up @@ -92,7 +91,6 @@ import {
Snapshot,
ChildDeletion,
StaticMask,
MutationMask,
Passive,
ForceClientRender,
MaySuspendCommit,
Expand Down Expand Up @@ -205,7 +203,7 @@ function markUpdate(workInProgress: Fiber) {
* it received an update that requires a clone of the tree above.
*/
function markCloned(workInProgress: Fiber) {
if (supportsPersistence && enablePersistedModeClonedFlag) {
if (supportsPersistence) {
workInProgress.flags |= Cloned;
}
}
Expand All @@ -227,9 +225,7 @@ function doesRequireClone(current: null | Fiber, completedWork: Fiber) {
// then we only have to check the `completedWork.subtreeFlags`.
let child = completedWork.child;
while (child !== null) {
const checkedFlags = enablePersistedModeClonedFlag
? Cloned | Visibility | Placement | ChildDeletion
: MutationMask;
const checkedFlags = Cloned | Visibility | Placement | ChildDeletion;
if (
(child.flags & checkedFlags) !== NoFlags ||
(child.subtreeFlags & checkedFlags) !== NoFlags
Expand Down Expand Up @@ -526,16 +522,9 @@ function updateHostComponent(
markUpdate(workInProgress);
}
workInProgress.stateNode = newInstance;
if (!requiresClone) {
if (!enablePersistedModeClonedFlag) {
// If there are no other effects in this tree, we need to flag this node as having one.
// Even though we're not going to use it for anything.
// Otherwise parents won't know that there are new children to propagate upwards.
markUpdate(workInProgress);
}
} else if (
!passChildrenWhenCloningPersistedNodes ||
hasOffscreenComponentChild
if (
requiresClone &&
(!passChildrenWhenCloningPersistedNodes || hasOffscreenComponentChild)
) {
// If children have changed, we have to add them all to the set.
appendAllChildren(
Expand Down Expand Up @@ -693,11 +682,6 @@ function updateHostText(
currentHostContext,
workInProgress,
);
if (!enablePersistedModeClonedFlag) {
// We'll have to mark it as having an effect, even though we won't use the effect for anything.
// This lets the parents know that at least one of their children has changed.
markUpdate(workInProgress);
}
} else {
workInProgress.stateNode = current.stateNode;
}
Expand Down
6 changes: 0 additions & 6 deletions packages/shared/ReactFeatureFlags.js
Original file line number Diff line number Diff line change
Expand Up @@ -129,12 +129,6 @@ export const alwaysThrottleRetries: boolean = true;

export const passChildrenWhenCloningPersistedNodes: boolean = false;

/**
* Enables a new Fiber flag used in persisted mode to reduce the number
* of cloned host components.
*/
export const enablePersistedModeClonedFlag: boolean = false;

export const enableEagerAlternateStateNodeCleanup: boolean = true;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
export const alwaysThrottleRetries = __VARIANT__;
export const enableObjectFiber = __VARIANT__;
export const enableHiddenSubtreeInsertionEffectCleanup = __VARIANT__;
export const enablePersistedModeClonedFlag = __VARIANT__;
export const enableEagerAlternateStateNodeCleanup = __VARIANT__;
export const passChildrenWhenCloningPersistedNodes = __VARIANT__;
export const renameElementSymbol = __VARIANT__;
Expand Down
1 change: 0 additions & 1 deletion packages/shared/forks/ReactFeatureFlags.native-fb.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ export const {
alwaysThrottleRetries,
enableHiddenSubtreeInsertionEffectCleanup,
enableObjectFiber,
enablePersistedModeClonedFlag,
enableEagerAlternateStateNodeCleanup,
passChildrenWhenCloningPersistedNodes,
renameElementSymbol,
Expand Down
1 change: 0 additions & 1 deletion packages/shared/forks/ReactFeatureFlags.native-oss.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ export const enableLegacyFBSupport: boolean = false;
export const enableLegacyHidden: boolean = false;
export const enableNoCloningMemoCache: boolean = false;
export const enableObjectFiber: boolean = false;
export const enablePersistedModeClonedFlag: boolean = false;
export const enablePostpone: boolean = false;
export const enableReactTestRendererWarning: boolean = false;
export const enableRetryLaneExpiration: boolean = false;
Expand Down
1 change: 0 additions & 1 deletion packages/shared/forks/ReactFeatureFlags.test-renderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ export const enableFizzExternalRuntime: boolean = true;
export const alwaysThrottleRetries: boolean = true;

export const passChildrenWhenCloningPersistedNodes: boolean = false;
export const enablePersistedModeClonedFlag: boolean = false;
export const disableClientCache: boolean = true;

export const enableInfiniteRenderLoopDetection: boolean = false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ export const enableLegacyFBSupport = false;
export const enableLegacyHidden = false;
export const enableNoCloningMemoCache = false;
export const enableObjectFiber = false;
export const enablePersistedModeClonedFlag = false;
export const enablePostpone = false;
export const enableProfilerCommitHooks = __PROFILE__;
export const enableProfilerNestedUpdatePhase = __PROFILE__;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ export const enableFizzExternalRuntime: boolean = false;
export const alwaysThrottleRetries: boolean = true;

export const passChildrenWhenCloningPersistedNodes: boolean = false;
export const enablePersistedModeClonedFlag: boolean = false;
export const disableClientCache: boolean = true;

export const enableInfiniteRenderLoopDetection: boolean = false;
Expand Down
2 changes: 0 additions & 2 deletions packages/shared/forks/ReactFeatureFlags.www.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,6 @@ export const enableFizzExternalRuntime: boolean = true;

export const passChildrenWhenCloningPersistedNodes: boolean = false;

export const enablePersistedModeClonedFlag: boolean = false;

export const disableClientCache: boolean = true;

export const enableReactTestRendererWarning: boolean = false;
Expand Down
Loading