Skip to content

Commit 6a6959b

Browse files
committed
Cleanup enableServerComponentKeys flag
Flag is `true` everywhere but RN where it doesn't apply.
1 parent 6090cab commit 6a6959b

9 files changed

+3
-29
lines changed

packages/react-client/src/__tests__/ReactFlight-test.js

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1609,7 +1609,6 @@ describe('ReactFlight', () => {
16091609
expect(errors).toEqual([]);
16101610
});
16111611

1612-
// @gate enableServerComponentKeys
16131612
it('preserves state when keying a server component', async () => {
16141613
function StatefulClient({name}) {
16151614
const [state] = React.useState(name.toLowerCase());
@@ -1666,7 +1665,6 @@ describe('ReactFlight', () => {
16661665
);
16671666
});
16681667

1669-
// @gate enableServerComponentKeys
16701668
it('does not inherit keys of children inside a server component', async () => {
16711669
function StatefulClient({name, initial}) {
16721670
const [state] = React.useState(initial);
@@ -1739,7 +1737,6 @@ describe('ReactFlight', () => {
17391737
);
17401738
});
17411739

1742-
// @gate enableServerComponentKeys
17431740
it('shares state between single return and array return in a parent', async () => {
17441741
function StatefulClient({name, initial}) {
17451742
const [state] = React.useState(initial);
@@ -1980,7 +1977,6 @@ describe('ReactFlight', () => {
19801977
);
19811978
});
19821979

1983-
// @gate enableServerComponentKeys
19841980
it('preserves state with keys split across async work', async () => {
19851981
let resolve;
19861982
const promise = new Promise(r => (resolve = r));

packages/react-server/src/ReactFlightServer.js

Lines changed: 3 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ import {
1515
enableBinaryFlight,
1616
enablePostpone,
1717
enableTaint,
18-
enableServerComponentKeys,
1918
enableRefAsProp,
2019
enableServerComponentLogs,
2120
} from 'shared/ReactFeatureFlags';
@@ -681,9 +680,6 @@ function renderFragment(
681680
}
682681
}
683682
}
684-
if (!enableServerComponentKeys) {
685-
return children;
686-
}
687683
if (task.keyPath !== null) {
688684
// We have a Server Component that specifies a key but we're now splitting
689685
// the tree using a fragment.
@@ -724,9 +720,6 @@ function renderClientElement(
724720
key: null | string,
725721
props: any,
726722
): ReactJSONValue {
727-
if (!enableServerComponentKeys) {
728-
return [REACT_ELEMENT_TYPE, type, key, props];
729-
}
730723
// We prepend the terminal client element that actually gets serialized with
731724
// the keys of any Server Components which are not serialized.
732725
const keyPath = task.keyPath;
@@ -875,7 +868,7 @@ function createTask(
875868
if (typeof model === 'object' && model !== null) {
876869
// If we're about to write this into a new task we can assign it an ID early so that
877870
// any other references can refer to the value we're about to write.
878-
if (enableServerComponentKeys && (keyPath !== null || implicitSlot)) {
871+
if (keyPath !== null || implicitSlot) {
879872
// If we're in some kind of context we can't necessarily reuse this object depending
880873
// what parent components are used.
881874
} else {
@@ -1320,10 +1313,7 @@ function renderModelDestructive(
13201313
const writtenObjects = request.writtenObjects;
13211314
const existingId = writtenObjects.get(value);
13221315
if (existingId !== undefined) {
1323-
if (
1324-
enableServerComponentKeys &&
1325-
(task.keyPath !== null || task.implicitSlot)
1326-
) {
1316+
if (task.keyPath !== null || task.implicitSlot) {
13271317
// If we're in some kind of context we can't reuse the result of this render or
13281318
// previous renders of this element. We only reuse elements if they're not wrapped
13291319
// by another Server Component.
@@ -1452,10 +1442,7 @@ function renderModelDestructive(
14521442
// $FlowFixMe[method-unbinding]
14531443
if (typeof value.then === 'function') {
14541444
if (existingId !== undefined) {
1455-
if (
1456-
enableServerComponentKeys &&
1457-
(task.keyPath !== null || task.implicitSlot)
1458-
) {
1445+
if (task.keyPath !== null || task.implicitSlot) {
14591446
// If we're in some kind of context we can't reuse the result of this render or
14601447
// previous renders of this element. We only reuse Promises if they're not wrapped
14611448
// by another Server Component.

packages/shared/ReactFeatureFlags.js

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -158,9 +158,6 @@ export const enableFilterEmptyStringAttributesDOM = true;
158158
// Disabled caching behavior of `react/cache` in client runtimes.
159159
export const disableClientCache = false;
160160

161-
// Changes Server Components Reconciliation when they have keys
162-
export const enableServerComponentKeys = true;
163-
164161
/**
165162
* Enables a new error detection for infinite render loops from updates caused
166163
* by setState or similar outside of the component owning the state.

packages/shared/forks/ReactFeatureFlags.native-fb.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,6 @@ export const enableFizzExternalRuntime = true;
8484
export const enableUseDeferredValueInitialArg = true;
8585
export const disableClientCache = true;
8686

87-
export const enableServerComponentKeys = true;
8887
export const enableServerComponentLogs = true;
8988

9089
// TODO: Roll out with GK. Don't keep as dynamic flag for too long, though,

packages/shared/forks/ReactFeatureFlags.native-oss.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,6 @@ export const enableTaint = __NEXT_RN_MAJOR__;
5151
export const enableUnifiedSyncLane = __NEXT_RN_MAJOR__;
5252
export const enableFizzExternalRuntime = __NEXT_RN_MAJOR__; // DOM-only
5353
export const enableBinaryFlight = __NEXT_RN_MAJOR__; // DOM-only
54-
export const enableServerComponentKeys = __NEXT_RN_MAJOR__;
5554
export const enableServerComponentLogs = __NEXT_RN_MAJOR__;
5655

5756
// DEV-only but enabled in the next RN Major.

packages/shared/forks/ReactFeatureFlags.test-renderer.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,6 @@ export const passChildrenWhenCloningPersistedNodes = false;
7272
export const enableUseDeferredValueInitialArg = __EXPERIMENTAL__;
7373
export const disableClientCache = true;
7474

75-
export const enableServerComponentKeys = true;
7675
export const enableServerComponentLogs = true;
7776
export const enableInfiniteRenderLoopDetection = false;
7877

packages/shared/forks/ReactFeatureFlags.test-renderer.native-fb.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,6 @@ export const passChildrenWhenCloningPersistedNodes = false;
7575
export const enableUseDeferredValueInitialArg = __EXPERIMENTAL__;
7676
export const disableClientCache = true;
7777

78-
export const enableServerComponentKeys = true;
7978
export const enableServerComponentLogs = true;
8079

8180
export const enableRefAsProp = false;

packages/shared/forks/ReactFeatureFlags.test-renderer.www.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,6 @@ export const passChildrenWhenCloningPersistedNodes = false;
7474
export const enableUseDeferredValueInitialArg = true;
7575
export const disableClientCache = true;
7676

77-
export const enableServerComponentKeys = true;
7877
export const enableServerComponentLogs = true;
7978
export const enableInfiniteRenderLoopDetection = false;
8079

packages/shared/forks/ReactFeatureFlags.www.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,6 @@ export const passChildrenWhenCloningPersistedNodes = false;
101101
export const enableAsyncDebugInfo = false;
102102
export const disableClientCache = true;
103103

104-
export const enableServerComponentKeys = true;
105104
export const enableServerComponentLogs = true;
106105

107106
export const enableReactTestRendererWarning = false;

0 commit comments

Comments
 (0)