From 840276fc4eb439a94466389c6da70b72f8d896f0 Mon Sep 17 00:00:00 2001 From: Andrew Clark Date: Fri, 22 Mar 2019 11:31:26 -0700 Subject: [PATCH] Switch to new ReactFiberScheduler implementation Sets the `enableNewScheduler` feature flag to true. `yarn test` now runs against the new implementation, so use `yarn test-old-scheduler` to test the old implementation. Both commands will run in CI, in case we need to revert. --- package.json | 2 +- packages/shared/ReactFeatureFlags.js | 2 +- packages/shared/forks/ReactFeatureFlags.native-fb.js | 2 +- packages/shared/forks/ReactFeatureFlags.native-oss.js | 2 +- packages/shared/forks/ReactFeatureFlags.persistent.js | 2 +- packages/shared/forks/ReactFeatureFlags.test-renderer.js | 2 +- packages/shared/forks/ReactFeatureFlags.test-renderer.www.js | 2 +- packages/shared/forks/ReactFeatureFlags.www.js | 2 +- scripts/circleci/test_entry_point.sh | 2 +- ...g.source-new-scheduler.js => config.source-old-scheduler.js} | 2 +- scripts/jest/{setupNewScheduler.js => setupOldScheduler.js} | 2 +- 11 files changed, 11 insertions(+), 11 deletions(-) rename scripts/jest/{config.source-new-scheduler.js => config.source-old-scheduler.js} (81%) rename scripts/jest/{setupNewScheduler.js => setupOldScheduler.js} (78%) diff --git a/package.json b/package.json index 1699d6847ef41..0cb9c51bcebab 100644 --- a/package.json +++ b/package.json @@ -102,7 +102,7 @@ "test": "cross-env NODE_ENV=development jest --config ./scripts/jest/config.source.js", "test-persistent": "cross-env NODE_ENV=development jest --config ./scripts/jest/config.source-persistent.js", "test-fire": "cross-env NODE_ENV=development jest --config ./scripts/jest/config.source-fire.js", - "test-new-scheduler": "cross-env NODE_ENV=development jest --config ./scripts/jest/config.source-new-scheduler.js", + "test-old-scheduler": "cross-env NODE_ENV=development jest --config ./scripts/jest/config.source-old-scheduler.js", "test-prod": "cross-env NODE_ENV=production jest --config ./scripts/jest/config.source.js", "test-fire-prod": "cross-env NODE_ENV=production jest --config ./scripts/jest/config.source-fire.js", "test-prod-build": "yarn test-build-prod", diff --git a/packages/shared/ReactFeatureFlags.js b/packages/shared/ReactFeatureFlags.js index 9ace0090d6ca7..d4ca8405e1dcc 100644 --- a/packages/shared/ReactFeatureFlags.js +++ b/packages/shared/ReactFeatureFlags.js @@ -67,4 +67,4 @@ export const enableEventAPI = false; // Enables rewritten version of ReactFiberScheduler. Added in case we need to // quickly revert it. -export const enableNewScheduler = false; +export const enableNewScheduler = true; diff --git a/packages/shared/forks/ReactFeatureFlags.native-fb.js b/packages/shared/forks/ReactFeatureFlags.native-fb.js index 658f7781ff313..e509f584ed3a3 100644 --- a/packages/shared/forks/ReactFeatureFlags.native-fb.js +++ b/packages/shared/forks/ReactFeatureFlags.native-fb.js @@ -31,7 +31,7 @@ export const replayFailedUnitOfWorkWithInvokeGuardedCallback = __DEV__; export const warnAboutDeprecatedLifecycles = true; export const warnAboutDeprecatedSetNativeProps = true; export const enableEventAPI = false; -export const enableNewScheduler = false; +export const enableNewScheduler = true; // Only used in www builds. export function addUserTimingListener() { diff --git a/packages/shared/forks/ReactFeatureFlags.native-oss.js b/packages/shared/forks/ReactFeatureFlags.native-oss.js index e264fd3a34419..20998e0eaf679 100644 --- a/packages/shared/forks/ReactFeatureFlags.native-oss.js +++ b/packages/shared/forks/ReactFeatureFlags.native-oss.js @@ -28,7 +28,7 @@ export const warnAboutShorthandPropertyCollision = false; export const enableSchedulerDebugging = false; export const warnAboutDeprecatedSetNativeProps = false; export const enableEventAPI = false; -export const enableNewScheduler = false; +export const enableNewScheduler = true; // Only used in www builds. export function addUserTimingListener() { diff --git a/packages/shared/forks/ReactFeatureFlags.persistent.js b/packages/shared/forks/ReactFeatureFlags.persistent.js index 2b048a082236f..cf2daad77b5f2 100644 --- a/packages/shared/forks/ReactFeatureFlags.persistent.js +++ b/packages/shared/forks/ReactFeatureFlags.persistent.js @@ -28,7 +28,7 @@ export const warnAboutShorthandPropertyCollision = false; export const enableSchedulerDebugging = false; export const warnAboutDeprecatedSetNativeProps = false; export const enableEventAPI = false; -export const enableNewScheduler = false; +export const enableNewScheduler = true; // Only used in www builds. export function addUserTimingListener() { diff --git a/packages/shared/forks/ReactFeatureFlags.test-renderer.js b/packages/shared/forks/ReactFeatureFlags.test-renderer.js index 08fe309d20b79..fbd41ffa5e1a0 100644 --- a/packages/shared/forks/ReactFeatureFlags.test-renderer.js +++ b/packages/shared/forks/ReactFeatureFlags.test-renderer.js @@ -28,7 +28,7 @@ export const warnAboutShorthandPropertyCollision = false; export const enableSchedulerDebugging = false; export const warnAboutDeprecatedSetNativeProps = false; export const enableEventAPI = false; -export const enableNewScheduler = false; +export const enableNewScheduler = true; // Only used in www builds. export function addUserTimingListener() { diff --git a/packages/shared/forks/ReactFeatureFlags.test-renderer.www.js b/packages/shared/forks/ReactFeatureFlags.test-renderer.www.js index 4b5df2e904080..18dce7eeaa51e 100644 --- a/packages/shared/forks/ReactFeatureFlags.test-renderer.www.js +++ b/packages/shared/forks/ReactFeatureFlags.test-renderer.www.js @@ -26,7 +26,7 @@ export const warnAboutDeprecatedSetNativeProps = false; export const disableJavaScriptURLs = false; export const disableYielding = false; export const enableEventAPI = true; -export const enableNewScheduler = false; +export const enableNewScheduler = true; // Only used in www builds. export function addUserTimingListener() { diff --git a/packages/shared/forks/ReactFeatureFlags.www.js b/packages/shared/forks/ReactFeatureFlags.www.js index f47b6097e4027..ed692d15047f9 100644 --- a/packages/shared/forks/ReactFeatureFlags.www.js +++ b/packages/shared/forks/ReactFeatureFlags.www.js @@ -42,7 +42,7 @@ export const enableSuspenseServerRenderer = true; // I've chosen to make this a static flag instead of a dynamic flag controlled // by a GK so that it doesn't increase bundle size. It should still be easy // to rollback by reverting the commit that turns this on. -export const enableNewScheduler = false; +export const enableNewScheduler = true; let refCount = 0; export function addUserTimingListener() { diff --git a/scripts/circleci/test_entry_point.sh b/scripts/circleci/test_entry_point.sh index 6227b7c5dcbd0..5266dafbf5c59 100755 --- a/scripts/circleci/test_entry_point.sh +++ b/scripts/circleci/test_entry_point.sh @@ -11,7 +11,7 @@ if [ $((0 % CIRCLE_NODE_TOTAL)) -eq "$CIRCLE_NODE_INDEX" ]; then COMMANDS_TO_RUN+=('node ./scripts/tasks/flow-ci') COMMANDS_TO_RUN+=('node ./scripts/tasks/eslint') COMMANDS_TO_RUN+=('yarn test --maxWorkers=2') - COMMANDS_TO_RUN+=('yarn test-new-scheduler --maxWorkers=2') + COMMANDS_TO_RUN+=('yarn test-old-scheduler --maxWorkers=2') COMMANDS_TO_RUN+=('yarn test-persistent --maxWorkers=2') COMMANDS_TO_RUN+=('./scripts/circleci/check_license.sh') COMMANDS_TO_RUN+=('./scripts/circleci/check_modules.sh') diff --git a/scripts/jest/config.source-new-scheduler.js b/scripts/jest/config.source-old-scheduler.js similarity index 81% rename from scripts/jest/config.source-new-scheduler.js rename to scripts/jest/config.source-old-scheduler.js index 6d74d5bb1b0fa..cb049ae6d7ddc 100644 --- a/scripts/jest/config.source-new-scheduler.js +++ b/scripts/jest/config.source-old-scheduler.js @@ -5,7 +5,7 @@ const baseConfig = require('./config.base'); module.exports = Object.assign({}, baseConfig, { setupFiles: [ ...baseConfig.setupFiles, - require.resolve('./setupNewScheduler.js'), + require.resolve('./setupOldScheduler.js'), require.resolve('./setupHostConfigs.js'), ], }); diff --git a/scripts/jest/setupNewScheduler.js b/scripts/jest/setupOldScheduler.js similarity index 78% rename from scripts/jest/setupNewScheduler.js rename to scripts/jest/setupOldScheduler.js index d3d58bd5653db..591a03e119366 100644 --- a/scripts/jest/setupNewScheduler.js +++ b/scripts/jest/setupOldScheduler.js @@ -2,6 +2,6 @@ jest.mock('shared/ReactFeatureFlags', () => { const ReactFeatureFlags = require.requireActual('shared/ReactFeatureFlags'); - ReactFeatureFlags.enableNewScheduler = true; + ReactFeatureFlags.enableNewScheduler = false; return ReactFeatureFlags; });