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

[react-interactions] Add DO_NOT_USE to Scope methods #17835

Merged
merged 1 commit into from
Jan 15, 2020

Conversation

trueadm
Copy link
Contributor

@trueadm trueadm commented Jan 14, 2020

In attempt to make it clearer about existing experimental APIs and their internal usage. In the long term, the Scopes API is expected to change/go-away but for now, given it's internal usage we'll have to find incremental ways to safely migrate to better options. This PR is one small step of many in order to do that. This PR makes the following changes:

  • Adds a DO_NOT_USE prefix to most Scope API methods that are potentially dangerous and will likely change or go away.
  • Provides a new experiemental method call getChildContextValues that attempts to work with existing React Context. It find the nearest child context values for a given type and returns them as part of an array. The idea is to internally use this approach and gradually deprecate and remove the DO_NOT_USE APIs.

@trueadm trueadm requested a review from gaearon January 14, 2020 14:20
@facebook-github-bot facebook-github-bot added CLA Signed React Core Team Opened by a member of the React Core Team labels Jan 14, 2020
@codesandbox-ci
Copy link

codesandbox-ci bot commented Jan 14, 2020

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 c3bde90:

Sandbox Source
goofy-dust-bmt7y Configuration

@sizebot
Copy link

sizebot commented Jan 14, 2020

Details of bundled changes.

Comparing: f4ca909...c3bde90

react-native-renderer

File Filesize Diff Gzip Diff Prev Size Current Size Prev Gzip Current Gzip ENV
ReactFabric-dev.js +0.2% +0.1% 734.98 KB 736.09 KB 155.51 KB 155.65 KB RN_OSS_DEV
ReactNativeRenderer-dev.js +0.1% +0.1% 744.37 KB 745.47 KB 157.73 KB 157.87 KB RN_OSS_DEV
ReactNativeRenderer-prod.js 0.0% 0.0% 273.39 KB 273.39 KB 47 KB 47.01 KB RN_OSS_PROD
ReactNativeRenderer-profiling.js 0.0% 0.0% 284.56 KB 284.56 KB 49.15 KB 49.15 KB RN_OSS_PROFILING

react-reconciler

File Filesize Diff Gzip Diff Prev Size Current Size Prev Gzip Current Gzip ENV
react-reconciler.development.js +0.2% +0.1% 602.91 KB 604.01 KB 127.45 KB 127.56 KB NODE_DEV
react-reconciler.production.min.js 0.0% 0.0% 72.06 KB 72.06 KB 21.23 KB 21.23 KB NODE_PROD
react-reconciler-reflection.production.min.js 0.0% 🔺+0.1% 2.85 KB 2.85 KB 1.23 KB 1.24 KB NODE_PROD
react-reconciler-persistent.development.js +0.2% +0.1% 600.36 KB 601.45 KB 126.33 KB 126.45 KB NODE_DEV

react-dom

File Filesize Diff Gzip Diff Prev Size Current Size Prev Gzip Current Gzip ENV
react-dom-server.browser.production.min.js 0.0% 0.0% 19.94 KB 19.94 KB 7.39 KB 7.4 KB NODE_PROD
react-dom-test-utils.development.js 0.0% 0.0% 52.76 KB 52.76 KB 14.99 KB 14.99 KB NODE_DEV
react-dom.production.min.js 0.0% 0.0% 115.35 KB 115.35 KB 37.17 KB 37.17 KB UMD_PROD
react-dom-unstable-native-dependencies.development.js 0.0% 0.0% 60.59 KB 60.59 KB 15.99 KB 15.99 KB NODE_DEV
react-dom.development.js +0.1% +0.1% 943.96 KB 945.05 KB 213.07 KB 213.19 KB NODE_DEV
react-dom-unstable-fizz.browser.development.js 0.0% +0.1% 3.87 KB 3.87 KB 1.54 KB 1.54 KB UMD_DEV
react-dom-unstable-fizz.browser.development.js 0.0% +0.1% 3.7 KB 3.7 KB 1.49 KB 1.49 KB NODE_DEV
react-dom-test-utils.production.min.js 0.0% -0.0% 11.17 KB 11.17 KB 4.14 KB 4.14 KB UMD_PROD
react-dom-test-utils.production.min.js 0.0% -0.0% 10.94 KB 10.94 KB 4.08 KB 4.08 KB NODE_PROD
react-dom-unstable-native-dependencies.development.js 0.0% 0.0% 60.89 KB 60.89 KB 16.06 KB 16.06 KB UMD_DEV
react-dom.development.js +0.1% +0.1% 949.89 KB 950.99 KB 214.79 KB 214.91 KB UMD_DEV

react-art

File Filesize Diff Gzip Diff Prev Size Current Size Prev Gzip Current Gzip ENV
react-art.production.min.js 0.0% 0.0% 104.33 KB 104.33 KB 31.8 KB 31.8 KB UMD_PROD
react-art.development.js +0.2% +0.1% 671.22 KB 672.31 KB 145.68 KB 145.8 KB UMD_DEV
react-art.development.js +0.2% +0.1% 601.9 KB 602.99 KB 128.28 KB 128.39 KB NODE_DEV

react-test-renderer

File Filesize Diff Gzip Diff Prev Size Current Size Prev Gzip Current Gzip ENV
react-test-renderer.development.js +0.2% +0.1% 616.25 KB 617.34 KB 131.3 KB 131.42 KB UMD_DEV
react-test-renderer.production.min.js 0.0% 0.0% 71.48 KB 71.48 KB 21.89 KB 21.89 KB UMD_PROD
react-test-renderer.development.js +0.2% +0.1% 611.51 KB 612.61 KB 130.11 KB 130.23 KB NODE_DEV
react-test-renderer.production.min.js 0.0% 0.0% 71.17 KB 71.17 KB 21.51 KB 21.51 KB NODE_PROD

ReactDOM: size: 0.0%, gzip: 0.0%

Size changes (stable)

Generated by 🚫 dangerJS against c3bde90

@sizebot
Copy link

sizebot commented Jan 14, 2020

Details of bundled changes.

Comparing: f4ca909...c3bde90

react-test-renderer

File Filesize Diff Gzip Diff Prev Size Current Size Prev Gzip Current Gzip ENV
react-test-renderer.development.js +0.2% +0.1% 616.27 KB 617.37 KB 131.31 KB 131.43 KB UMD_DEV
react-test-renderer.production.min.js 0.0% 0.0% 71.5 KB 71.5 KB 21.91 KB 21.91 KB UMD_PROD
react-test-renderer.development.js +0.2% +0.1% 611.54 KB 612.63 KB 130.13 KB 130.25 KB NODE_DEV
react-test-renderer.production.min.js 0.0% 0.0% 71.19 KB 71.19 KB 21.52 KB 21.52 KB NODE_PROD
ReactTestRenderer-dev.js +0.2% +0.1% 627.38 KB 628.48 KB 130.91 KB 131.05 KB FB_WWW_DEV

react-native-renderer

File Filesize Diff Gzip Diff Prev Size Current Size Prev Gzip Current Gzip ENV
ReactNativeRenderer-dev.js +0.1% +0.1% 744.38 KB 745.48 KB 157.73 KB 157.87 KB RN_OSS_DEV
ReactFabric-dev.js +0.2% +0.1% 735 KB 736.1 KB 155.52 KB 155.66 KB RN_OSS_DEV
ReactNativeRenderer-dev.js +0.1% +0.1% 744.55 KB 745.66 KB 157.83 KB 157.97 KB RN_FB_DEV
ReactNativeRenderer-prod.js 0.0% 0.0% 273.4 KB 273.4 KB 47.01 KB 47.01 KB RN_OSS_PROD
ReactFabric-dev.js +0.1% +0.1% 735.18 KB 736.28 KB 155.61 KB 155.75 KB RN_FB_DEV
ReactNativeRenderer-profiling.js 0.0% 0.0% 284.58 KB 284.58 KB 49.16 KB 49.16 KB RN_OSS_PROFILING
ReactFabric-profiling.js 0.0% 0.0% 277.3 KB 277.3 KB 47.94 KB 47.94 KB RN_FB_PROFILING

react-art

File Filesize Diff Gzip Diff Prev Size Current Size Prev Gzip Current Gzip ENV
ReactART-dev.js +0.2% +0.1% 615.78 KB 616.88 KB 128.38 KB 128.53 KB FB_WWW_DEV
ReactART-prod.js 🔺+0.4% 🔺+0.3% 236.25 KB 237.24 KB 39.92 KB 40.05 KB FB_WWW_PROD
react-art.development.js +0.2% +0.1% 671.24 KB 672.34 KB 145.68 KB 145.8 KB UMD_DEV
react-art.production.min.js 0.0% 0.0% 106.83 KB 106.83 KB 32.49 KB 32.49 KB UMD_PROD
react-art.development.js +0.2% +0.1% 601.92 KB 603.02 KB 128.28 KB 128.4 KB NODE_DEV
react-art.production.min.js 0.0% 0.0% 71.78 KB 71.78 KB 21.64 KB 21.64 KB NODE_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% 137.73 KB 137.73 KB 36.6 KB 36.6 KB UMD_DEV
react-dom-test-utils.production.min.js 0.0% -0.1% 11.18 KB 11.18 KB 4.15 KB 4.15 KB UMD_PROD
react-dom-unstable-fizz.browser.development.js 0.0% +0.1% 3.71 KB 3.71 KB 1.5 KB 1.5 KB NODE_DEV
react-dom-test-utils.production.min.js 0.0% -0.0% 10.95 KB 10.95 KB 4.09 KB 4.09 KB NODE_PROD
react-dom.development.js +0.1% +0.1% 949.91 KB 951.01 KB 214.82 KB 214.93 KB UMD_DEV
react-dom.development.js +0.1% +0.1% 943.98 KB 945.07 KB 213.1 KB 213.22 KB NODE_DEV
react-dom-server.node.development.js 0.0% 0.0% 134.77 KB 134.77 KB 35.81 KB 35.81 KB NODE_DEV
react-dom-server.node.production.min.js 0.0% 0.0% 20.8 KB 20.8 KB 7.63 KB 7.63 KB NODE_PROD
ReactDOM-dev.js +0.1% +0.1% 971.8 KB 972.9 KB 216.06 KB 216.19 KB FB_WWW_DEV
ReactDOM-prod.js 🔺+0.3% 🔺+0.2% 393.68 KB 394.67 KB 72.09 KB 72.22 KB FB_WWW_PROD
react-dom-unstable-native-dependencies.development.js 0.0% 0.0% 60.91 KB 60.91 KB 16.07 KB 16.07 KB UMD_DEV
ReactDOM-profiling.js +0.2% +0.2% 404.98 KB 405.96 KB 74.24 KB 74.37 KB FB_WWW_PROFILING
react-dom-unstable-native-dependencies.production.min.js 0.0% -0.0% 9.97 KB 9.97 KB 3.37 KB 3.37 KB NODE_PROD
ReactDOMServer-dev.js 0.0% 0.0% 139.4 KB 139.4 KB 35.43 KB 35.43 KB FB_WWW_DEV

react-reconciler

File Filesize Diff Gzip Diff Prev Size Current Size Prev Gzip Current Gzip ENV
react-reconciler-persistent.development.js +0.2% +0.1% 600.37 KB 601.47 KB 126.33 KB 126.45 KB NODE_DEV
react-reconciler-reflection.production.min.js 0.0% 🔺+0.1% 2.86 KB 2.86 KB 1.24 KB 1.24 KB NODE_PROD
react-reconciler.development.js +0.2% +0.1% 602.92 KB 604.02 KB 127.45 KB 127.56 KB NODE_DEV

Size changes (experimental)

Generated by 🚫 dangerJS against c3bde90

@@ -14,74 +14,11 @@ can be found [here](./docs).

Note: React Scopes require the internal React flag `enableScopeAPI`.

When creating a scope, a query function is required. The query function is used
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm removing this document as we really don't want people to be actively using any of these APIs right now.

Copy link
Collaborator

@gaearon gaearon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds ok to me!

@trueadm trueadm merged commit b6173e6 into facebook:master Jan 15, 2020
@trueadm trueadm deleted the scope-child-context branch January 15, 2020 09:50
trueadm added a commit to trueadm/react that referenced this pull request Jan 17, 2020
trueadm added a commit to trueadm/react that referenced this pull request Jan 17, 2020
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.

4 participants