Skip to content

Commit

Permalink
unify feature flags between fb and oss for React Native renderer (fac…
Browse files Browse the repository at this point in the history
…ebook#28269)

# Affected flags:

### alwaysThrottleRetries

In RN OSS changed from `true` to `false`. This is what FB build uses.
This flag was a root cause for big perf regression internally.

### enableDeferRootSchedulingToMicrotask

In RN OSS build changed from `true` to `false`. This is what FB build
uses.

### debugRenderPhaseSideEffectsForStrictMode

Changed from true to __DEV__ in FB and OSS build. The flag is only used
in debug builds and was previously `false` in RN OSS builds

### enableUnifiedSyncLane

Changed from `__VARIANT__` to `true` in FB build. This is what OSS build
uses. This flag is shipped internally. cc @tyao1

### enableLegacyHidden

In RN FB changed from `true` to `false`.  This is what OSS uses.

### allowConcurrentByDefault

In RN FB changed from `true` to `false`. 




I ran `yarn flags --diff rn rn-fb` to get the difference between feature
flags and unify them.

## Before
```
yarn run v1.22.19
$ node ./scripts/flags/flags.js --diff rn rn-fb
┌───────────────────────────────────────────────┬────────┬───────┐
│                    (index)                    │ RN OSS │ RN FB │
├───────────────────────────────────────────────┼────────┼───────┤
│ allowConcurrentByDefault                      │  '❌'  │ '✅'  │
│ debugRenderPhaseSideEffectsForStrictMode      │  '❌'  │ '✅'  │
│ disableModulePatternComponents                │  '❌'  │ '✅'  │
│ enableCPUSuspense                             │  '❌'  │ '✅'  │
│ enableCacheElement                            │  '❌'  │ '✅'  │
│ enableGetInspectorDataForInstanceInProduction │  '❌'  │ '✅'  │
│ enableLegacyHidden                            │  '❌'  │ '✅'  │
│ enableSchedulingProfiler                      │  '❌'  │ '📊'  │
│ enableUseDeferredValueInitialArg              │  '❌'  │ '✅'  │
│ enableUseMemoCacheHook                        │  '❌'  │ '✅'  │
│ enableUseRefAccessWarning                     │  '❌'  │ '🧪'  │
│ passChildrenWhenCloningPersistedNodes         │  '❌'  │ '🧪'  │
│ useMicrotasksForSchedulingInFabric            │  '❌'  │ '🧪'  │
│ alwaysThrottleRetries                         │  '✅'  │ '🧪'  │
│ enableDeferRootSchedulingToMicrotask          │  '✅'  │ '🧪'  │
│ enableUnifiedSyncLane                         │  '✅'  │ '🧪'  │
└───────────────────────────────────────────────┴────────┴───────┘
```

## After
```
yarn run v1.22.19
$ node ./scripts/flags/flags.js --diff rn rn-fb
┌───────────────────────────────────────────────┬────────┬───────┐
│                    (index)                    │ RN OSS │ RN FB │
├───────────────────────────────────────────────┼────────┼───────┤
│ alwaysThrottleRetries                         │  '❌'  │ '🧪'  │
│ disableModulePatternComponents                │  '❌'  │ '✅'  │
│ enableCPUSuspense                             │  '❌'  │ '✅'  │
│ enableCacheElement                            │  '❌'  │ '✅'  │
│ enableDeferRootSchedulingToMicrotask          │  '❌'  │ '🧪'  │
│ enableGetInspectorDataForInstanceInProduction │  '❌'  │ '✅'  │
│ enableSchedulingProfiler                      │  '❌'  │ '📊'  │
│ enableUseDeferredValueInitialArg              │  '❌'  │ '✅'  │
│ enableUseMemoCacheHook                        │  '❌'  │ '✅'  │
│ enableUseRefAccessWarning                     │  '❌'  │ '🧪'  │
│ passChildrenWhenCloningPersistedNodes         │  '❌'  │ '🧪'  │
│ useMicrotasksForSchedulingInFabric            │  '❌'  │ '🧪'  │
└───────────────────────────────────────────────┴────────┴───────┘
```
  • Loading branch information
sammy-SC authored and AndyPengc12 committed Apr 15, 2024
1 parent 261a0cb commit cdc8ee9
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ import typeof * as DynamicFlagsType from 'ReactNativeInternalFeatureFlags';

export const alwaysThrottleRetries = __VARIANT__;
export const enableDeferRootSchedulingToMicrotask = __VARIANT__;
export const enableUnifiedSyncLane = __VARIANT__;
export const enableUseRefAccessWarning = __VARIANT__;
export const passChildrenWhenCloningPersistedNodes = __VARIANT__;
export const useMicrotasksForSchedulingInFabric = __VARIANT__;
Expand Down
8 changes: 4 additions & 4 deletions packages/shared/forks/ReactFeatureFlags.native-fb.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ import * as dynamicFlags from 'ReactNativeInternalFeatureFlags';
export const {
alwaysThrottleRetries,
enableDeferRootSchedulingToMicrotask,
enableUnifiedSyncLane,
enableUseRefAccessWarning,
passChildrenWhenCloningPersistedNodes,
useMicrotasksForSchedulingInFabric,
Expand All @@ -44,13 +43,14 @@ export const enableFormActions = true; // Doesn't affect Native
export const enableBinaryFlight = true;
export const enableTaint = true;
export const enablePostpone = false;
export const debugRenderPhaseSideEffectsForStrictMode = true;
export const debugRenderPhaseSideEffectsForStrictMode = __DEV__;
export const disableJavaScriptURLs = false;
export const disableCommentsAsDOMContainers = true;
export const disableInputAttributeSyncing = false;
export const disableIEWorkarounds = true;
export const replayFailedUnitOfWorkWithInvokeGuardedCallback = __DEV__;
export const enableScopeAPI = false;
export const enableUnifiedSyncLane = true;
export const enableCreateEventHandleAPI = false;
export const enableSuspenseCallback = false;
export const disableLegacyContext = false;
Expand All @@ -74,9 +74,9 @@ export const transitionLaneExpirationMs = 5000;

export const disableSchedulerTimeoutInWorkLoop = false;
export const enableLazyContextPropagation = false;
export const enableLegacyHidden = true;
export const enableLegacyHidden = false;
export const forceConcurrentByDefaultForTesting = false;
export const allowConcurrentByDefault = true;
export const allowConcurrentByDefault = false;
export const enableCustomElementPropertySupport = false;

export const consoleManagedByDevToolsDuringStrictMode = false;
Expand Down
6 changes: 3 additions & 3 deletions packages/shared/forks/ReactFeatureFlags.native-oss.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
import typeof * as FeatureFlagsType from 'shared/ReactFeatureFlags';
import typeof * as ExportsType from './ReactFeatureFlags.native-oss';

export const debugRenderPhaseSideEffectsForStrictMode = false;
export const debugRenderPhaseSideEffectsForStrictMode = __DEV__;
export const enableDebugTracing = false;
export const enableAsyncDebugInfo = false;
export const enableSchedulingProfiler = false;
Expand Down Expand Up @@ -74,11 +74,11 @@ export const enableFloat = true;
export const useModernStrictMode = false;
export const enableDO_NOT_USE_disableStrictPassiveEffect = false;
export const enableFizzExternalRuntime = false;
export const enableDeferRootSchedulingToMicrotask = true;
export const enableDeferRootSchedulingToMicrotask = false;

export const enableAsyncActions = false;

export const alwaysThrottleRetries = true;
export const alwaysThrottleRetries = false;

export const useMicrotasksForSchedulingInFabric = false;
export const passChildrenWhenCloningPersistedNodes = false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ export const enableFloat = true;

export const useModernStrictMode = false;
export const enableDO_NOT_USE_disableStrictPassiveEffect = false;
export const enableDeferRootSchedulingToMicrotask = true;
export const enableDeferRootSchedulingToMicrotask = false;

export const enableAsyncActions = true;

Expand Down
1 change: 0 additions & 1 deletion scripts/flow/xplat.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
declare module 'ReactNativeInternalFeatureFlags' {
declare export var alwaysThrottleRetries: boolean;
declare export var enableDeferRootSchedulingToMicrotask: boolean;
declare export var enableUnifiedSyncLane: boolean;
declare export var enableUseRefAccessWarning: boolean;
declare export var passChildrenWhenCloningPersistedNodes: boolean;
declare export var useMicrotasksForSchedulingInFabric: boolean;
Expand Down

0 comments on commit cdc8ee9

Please sign in to comment.