Skip to content

Commit 7b636d2

Browse files
committed
Add enableRefAsProp feature flag
Adding a flag for this so it can be rolled out incrementally at Meta.
1 parent a1af97b commit 7b636d2

7 files changed

+31
-0
lines changed

packages/shared/ReactFeatureFlags.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,13 @@ export const enableServerComponentKeys = __NEXT_MAJOR__;
178178
*/
179179
export const enableInfiniteRenderLoopDetection = true;
180180

181+
// Subtle breaking changes to JSX runtime to make it faster, like passing `ref`
182+
// as a normal prop instead of stripping it from the props object.
183+
184+
// Passes `ref` as a normal prop instead of stripping it from the props object
185+
// during element creation.
186+
export const enableRefAsProp = __NEXT_MAJOR__;
187+
181188
// -----------------------------------------------------------------------------
182189
// Chopping Block
183190
//

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,5 +97,9 @@ export const disableClientCache = true;
9797
export const enableServerComponentKeys = true;
9898
export const enableInfiniteRenderLoopDetection = false;
9999

100+
// TODO: Roll out with GK. Don't keep as dynamic flag for too long, though,
101+
// because JSX is an extremely hot path.
102+
export const enableRefAsProp = false;
103+
100104
// Flow magic to verify the exports of this file match the original version.
101105
((((null: any): ExportsType): FeatureFlagsType): ExportsType);

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,5 +89,8 @@ export const disableClientCache = true;
8989

9090
export const enableServerComponentKeys = true;
9191

92+
// TODO: Should turn this on in next "major" RN release.
93+
export const enableRefAsProp = false;
94+
9295
// Flow magic to verify the exports of this file match the original version.
9396
((((null: any): ExportsType): FeatureFlagsType): ExportsType);

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

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,5 +89,14 @@ export const disableClientCache = true;
8989
export const enableServerComponentKeys = true;
9090
export const enableInfiniteRenderLoopDetection = false;
9191

92+
// TODO: This must be in sync with the main ReactFeatureFlags file because
93+
// the Test Renderer's value must be the same as the one used by the
94+
// react package.
95+
//
96+
// We really need to get rid of this whole module. Any test renderer specific
97+
// flags should be handled by the Fiber config.
98+
const __NEXT_MAJOR__ = __EXPERIMENTAL__;
99+
export const enableRefAsProp = __NEXT_MAJOR__;
100+
92101
// Flow magic to verify the exports of this file match the original version.
93102
((((null: any): ExportsType): FeatureFlagsType): ExportsType);

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,5 +86,7 @@ export const disableClientCache = true;
8686

8787
export const enableServerComponentKeys = true;
8888

89+
export const enableRefAsProp = false;
90+
8991
// Flow magic to verify the exports of this file match the original version.
9092
((((null: any): ExportsType): FeatureFlagsType): ExportsType);

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,5 +89,7 @@ export const disableClientCache = true;
8989
export const enableServerComponentKeys = true;
9090
export const enableInfiniteRenderLoopDetection = false;
9191

92+
export const enableRefAsProp = false;
93+
9294
// Flow magic to verify the exports of this file match the original version.
9395
((((null: any): ExportsType): FeatureFlagsType): ExportsType);

packages/shared/forks/ReactFeatureFlags.www.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,5 +116,9 @@ export const disableClientCache = true;
116116

117117
export const enableServerComponentKeys = true;
118118

119+
// TODO: Roll out with GK. Don't keep as dynamic flag for too long, though,
120+
// because JSX is an extremely hot path.
121+
export const enableRefAsProp = false;
122+
119123
// Flow magic to verify the exports of this file match the original version.
120124
((((null: any): ExportsType): FeatureFlagsType): ExportsType);

0 commit comments

Comments
 (0)