Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DEV warning for "strict effects mode" (Facebook only) #20694

Conversation

bvaughn
Copy link
Contributor

@bvaughn bvaughn commented Jan 29, 2021

This commit adds a temporary DEV mode warning that explains strict effects mode. It's intended for Facebook builds only, because the warning includes Facebook specific instructions for how to disable it (using a GK blocklist). If we decide to add a similar warning for OSS we'll need to revisit both the wording and the opt-out mechansim.


Note that this new warning is controlled by two new feature flags so that (1) we can enable it for 100% of Facebook engineers¹² only (no OSS) and (2) provide a simple opt-out mechanism for engineers who know about the mode and no longer want to see the warning.

¹ This warning will not be logged for legacy applications that aren't in strict effects mode.
² GKs within Facebook can't be enabled for 100% of a population.

enableStrictEffectsModeDevWarningForFacebookOnly is enabled statically at build time and is used to enable the warning within Facebook builds only. bypassStrictEffectsModeDevWarningForFacebookOnly is a dynamic flag and provides an opt-out mechanism (allowlisting yourself to a GK).

Both flags are gated behind an extra __DEV__ check so they should not impact production build size.

@facebook-github-bot facebook-github-bot added the React Core Team Opened by a member of the React Core Team label Jan 29, 2021
@bvaughn bvaughn requested a review from gaearon January 29, 2021 20:18
@codesandbox-ci
Copy link

codesandbox-ci bot commented Jan 29, 2021

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Latest deployment of this branch, based on commit 97ca787:

Sandbox Source
React Configuration

@bvaughn bvaughn force-pushed the strict-effects-mode-dev-console-warning branch from a18097f to cc293cf Compare January 29, 2021 20:23
@bvaughn bvaughn closed this Jan 29, 2021
@sizebot
Copy link

sizebot commented Jan 29, 2021

Details of bundled changes.

Comparing: bb1b795...97ca787

react-art

File Filesize Diff Gzip Diff Prev Size Current Size Prev Gzip Current Gzip ENV
ReactART-dev.js +0.3% +0.5% 662.49 KB 664.39 KB 140.64 KB 141.31 KB FB_WWW_DEV
react-art.development.js 0.0% 0.0% 718.22 KB 718.22 KB 152.51 KB 152.51 KB UMD_DEV
react-art.production.min.js 0.0% 0.0% 114.02 KB 114.02 KB 35.59 KB 35.59 KB UMD_PROD
react-art.development.js 0.0% 0.0% 618.07 KB 618.07 KB 134.47 KB 134.47 KB NODE_DEV
react-art.production.min.js 0.0% 0.0% 78.96 KB 78.96 KB 24.72 KB 24.72 KB NODE_PROD
ReactART-prod.js 0.0% 0.0% 244.73 KB 244.73 KB 43.64 KB 43.64 KB FB_WWW_PROD

react-dom

File Filesize Diff Gzip Diff Prev Size Current Size Prev Gzip Current Gzip ENV
react-dom-server.browser.development.js 0.0% 0.0% 145.08 KB 145.08 KB 36.93 KB 36.93 KB UMD_DEV
react-dom-server.browser.production.min.js 0.0% 0.0% 20.42 KB 20.42 KB 7.57 KB 7.58 KB UMD_PROD
react-dom-server.node.production.min.js 0.0% 0.0% 20.75 KB 20.75 KB 7.68 KB 7.68 KB NODE_PROD
react-dom.development.js 0.0% 0.0% 981.09 KB 981.09 KB 214.39 KB 214.39 KB UMD_DEV
ReactTestUtils-dev.js +0.2% +0.2% 61.5 KB 61.63 KB 16.94 KB 16.96 KB FB_WWW_DEV
react-dom.production.min.js 0.0% 0.0% 124.84 KB 124.84 KB 40.97 KB 40.97 KB UMD_PROD
react-dom.profiling.min.js 0.0% 0.0% 130.54 KB 130.54 KB 42.7 KB 42.7 KB UMD_PROFILING
ReactDOMForked-dev.js +0.2% +0.3% 1001.39 KB 1003.29 KB 222.32 KB 222.99 KB FB_WWW_DEV
react-dom-unstable-fizz.node.production.min.js 0.0% 🔺+0.2% 1.17 KB 1.17 KB 666 B 667 B NODE_PROD
react-dom.production.min.js 0.0% 0.0% 125 KB 125 KB 40.31 KB 40.32 KB NODE_PROD
react-dom.profiling.min.js 0.0% 0.0% 130.87 KB 130.87 KB 42.04 KB 42.04 KB NODE_PROFILING
ReactDOM-dev.js +0.2% +0.3% 996.13 KB 998.03 KB 221.39 KB 222.05 KB FB_WWW_DEV
react-dom-unstable-fizz.browser.production.min.js 0.0% 🔺+0.3% 1.01 KB 1.01 KB 616 B 618 B NODE_PROD
ReactDOM-prod.js 0.0% 0.0% 381.87 KB 381.87 KB 71.14 KB 71.15 KB FB_WWW_PROD
react-dom-server.browser.development.js 0.0% 0.0% 137.62 KB 137.62 KB 36.5 KB 36.5 KB NODE_DEV
react-dom-server.browser.production.min.js 0.0% 0.0% 20.33 KB 20.33 KB 7.53 KB 7.53 KB NODE_PROD
react-dom-test-utils.development.js 0.0% 0.0% 71.37 KB 71.37 KB 19.33 KB 19.33 KB UMD_DEV
ReactDOMServer-dev.js +0.1% +0.1% 142.52 KB 142.64 KB 36.63 KB 36.66 KB FB_WWW_DEV
react-dom-test-utils.production.min.js 0.0% 0.0% 13.71 KB 13.71 KB 5.32 KB 5.32 KB UMD_PROD
react-dom-test-utils.development.js 0.0% 0.0% 66.18 KB 66.18 KB 18.81 KB 18.81 KB NODE_DEV
ReactDOMTesting-dev.js 0.0% 0.0% 919.6 KB 919.6 KB 206.98 KB 206.98 KB FB_WWW_DEV

ReactDOM: size: 0.0%, gzip: 0.0%

Size changes (experimental)

Generated by 🚫 dangerJS against 97ca787

@sizebot
Copy link

sizebot commented Jan 29, 2021

Details of bundled changes.

Comparing: bb1b795...97ca787

react-art

File Filesize Diff Gzip Diff Prev Size Current Size Prev Gzip Current Gzip ENV
ReactART-dev.js +0.3% +0.5% 672.5 KB 674.4 KB 142.67 KB 143.34 KB FB_WWW_DEV
react-art.development.js 0.0% 0.0% 675.96 KB 675.96 KB 144.07 KB 144.07 KB UMD_DEV
react-art.production.min.js 0.0% 0.0% 109.23 KB 109.23 KB 34.13 KB 34.14 KB UMD_PROD
react-art.production.min.js 0.0% 0.0% 74.23 KB 74.23 KB 23.25 KB 23.25 KB NODE_PROD
ReactART-prod.js 0.0% 0.0% 251.94 KB 251.94 KB 44.89 KB 44.89 KB FB_WWW_PROD

react-dom

File Filesize Diff Gzip Diff Prev Size Current Size Prev Gzip Current Gzip ENV
react-dom-server.browser.development.js 0.0% -0.0% 143.17 KB 143.17 KB 36.67 KB 36.66 KB UMD_DEV
react-dom-test-utils.production.min.js 0.0% 0.0% 13.68 KB 13.68 KB 5.25 KB 5.26 KB NODE_PROD
ReactTestUtils-dev.js +0.2% +0.2% 61.5 KB 61.63 KB 16.93 KB 16.96 KB FB_WWW_DEV
react-dom.production.min.js 0.0% 0.0% 118.48 KB 118.48 KB 39 KB 39 KB UMD_PROD
react-dom.profiling.min.js 0.0% 0.0% 122.58 KB 122.58 KB 40.25 KB 40.26 KB UMD_PROFILING
react-dom.development.js 0.0% -0.0% 883.61 KB 883.61 KB 201.71 KB 201.7 KB NODE_DEV
ReactDOMForked-dev.js +0.2% +0.3% 1 MB 1 MB 227.15 KB 227.81 KB FB_WWW_DEV
react-dom.production.min.js 0.0% 0.0% 118.56 KB 118.56 KB 38.31 KB 38.31 KB NODE_PROD
react-dom.profiling.min.js 0.0% 0.0% 122.82 KB 122.82 KB 39.57 KB 39.58 KB NODE_PROFILING
ReactDOMForked-profiling.js 0.0% 0.0% 414.61 KB 414.61 KB 76.68 KB 76.68 KB FB_WWW_PROFILING
ReactDOM-dev.js +0.2% +0.3% 1021.71 KB 1023.61 KB 226.18 KB 226.84 KB FB_WWW_DEV
react-dom-test-utils.development.js 0.0% 0.0% 71.36 KB 71.36 KB 19.32 KB 19.32 KB UMD_DEV
ReactDOMServer-dev.js +0.1% +0.1% 146.55 KB 146.67 KB 37.64 KB 37.67 KB FB_WWW_DEV
react-dom-test-utils.production.min.js 0.0% 0.0% 13.7 KB 13.7 KB 5.31 KB 5.31 KB UMD_PROD
react-dom-test-utils.development.js 0.0% 0.0% 66.17 KB 66.17 KB 18.8 KB 18.81 KB NODE_DEV
ReactDOMTesting-dev.js 0.0% 0.0% 947.94 KB 947.94 KB 212.67 KB 212.67 KB FB_WWW_DEV

Size changes (stable)

Generated by 🚫 dangerJS against 97ca787

@bvaughn bvaughn reopened this Jan 29, 2021
@bvaughn bvaughn force-pushed the strict-effects-mode-dev-console-warning branch from cc293cf to edf51d1 Compare January 29, 2021 20:31
@bvaughn
Copy link
Contributor Author

bvaughn commented Jan 29, 2021

Oops I need to tweak this to use two flags: one to enable it for FB only and one to allow developers to opt-out. The reason here is that I can't set a GK to 100% of employees. Will update momentarily.

@bvaughn
Copy link
Contributor Author

bvaughn commented Jan 29, 2021

CI test ci/circleci: yarn_test--r=www-classic --env=development --variant looks like it failed but opening it in CI shows all tests passed. They just took a little too long to finish.

This commit adds a temporary DEV mode warning that explains strict effects mode. It's intended for Facebook builds only, because the warning includes Facebook specific instructions for how to disable it (using a GK blocklist). If we decide to add a similar warning for OSS we'll need to revisit both the wording and the opt-out mechansim.

This new behavior is controlled by two separate flags. This lets us (a) can enable it for 100% of Facebook engineers¹² and (b) provide a simple opt-out mechanism for engineers who know about the mode and no longer want to see the warning.

¹ This warning will not be logged for legacy applications that aren't in strict effects mode.
² GKs within Facebook can't be enabled for 100% of a population.
@bvaughn bvaughn force-pushed the strict-effects-mode-dev-console-warning branch from 741626e to 97ca787 Compare January 29, 2021 21:51
@bvaughn
Copy link
Contributor Author

bvaughn commented Feb 1, 2021

Opened an internal Diff with an alternate way of adding this warning (via a wrapper around the create-root entry points).

@bvaughn
Copy link
Contributor Author

bvaughn commented Feb 1, 2021

Closing in favor of the Facebook wrapper approach mentioned above.

@bvaughn bvaughn closed this Feb 1, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed React Core Team Opened by a member of the React Core Team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants