From bd76ce54d93153cc84d861bd59e906bc28e1c160 Mon Sep 17 00:00:00 2001 From: Jack Pope Date: Thu, 19 Dec 2024 11:49:14 -0500 Subject: [PATCH] Fork Scheduler feature flags for native-fb (#31859) #31787 introduces an experimental scheduler flag: `enableAlwaysYieldScheduler`, which is turned off for www. There wasn't a SchedulerFeatureFlags fork for native-fb, so the experimental change was enabled in the Scheduler-dev build there which causes test failures and is blocking the sync. #31805 introduces another scheduler flag `enableRequestPaint`, which is set as a `__VARIANT__` on www. I've set this to `true` here to preserve the existing behavior. We can follow up with dynamic flags for native-fb after unblocking the sync. --- .../forks/SchedulerFeatureFlags.native-fb.js | 18 ++++++++++++++++++ scripts/rollup/forks.js | 18 +++++++++++------- 2 files changed, 29 insertions(+), 7 deletions(-) create mode 100644 packages/scheduler/src/forks/SchedulerFeatureFlags.native-fb.js diff --git a/packages/scheduler/src/forks/SchedulerFeatureFlags.native-fb.js b/packages/scheduler/src/forks/SchedulerFeatureFlags.native-fb.js new file mode 100644 index 0000000000..d9d3dc7338 --- /dev/null +++ b/packages/scheduler/src/forks/SchedulerFeatureFlags.native-fb.js @@ -0,0 +1,18 @@ +/** + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + * @flow + */ + +export const enableProfiling = __DEV__; +export const frameYieldMs = 5; + +export const userBlockingPriorityTimeout = 250; +export const normalPriorityTimeout = 5000; +export const lowPriorityTimeout = 10000; +export const enableRequestPaint = true; + +export const enableAlwaysYieldScheduler = false; diff --git a/scripts/rollup/forks.js b/scripts/rollup/forks.js index 2d6f718c76..5460304366 100644 --- a/scripts/rollup/forks.js +++ b/scripts/rollup/forks.js @@ -195,14 +195,18 @@ const forks = Object.freeze({ entry, dependencies ) => { - if ( - bundleType === FB_WWW_DEV || - bundleType === FB_WWW_PROD || - bundleType === FB_WWW_PROFILING - ) { - return './packages/scheduler/src/forks/SchedulerFeatureFlags.www.js'; + switch (bundleType) { + case FB_WWW_DEV: + case FB_WWW_PROD: + case FB_WWW_PROFILING: + return './packages/scheduler/src/forks/SchedulerFeatureFlags.www.js'; + case RN_FB_DEV: + case RN_FB_PROD: + case RN_FB_PROFILING: + return './packages/scheduler/src/forks/SchedulerFeatureFlags.native-fb.js'; + default: + return './packages/scheduler/src/SchedulerFeatureFlags.js'; } - return './packages/scheduler/src/SchedulerFeatureFlags.js'; }, './packages/shared/consoleWithStackDev.js': (bundleType, entry) => {