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] Adds more experimental Scope API methods #17042

Merged
merged 3 commits into from
Oct 8, 2019

Conversation

trueadm
Copy link
Contributor

@trueadm trueadm commented Oct 8, 2019

This PR adds two more internal API methods to React Scopes. Note: these are experimental and may change at any time. Notably, the changes are:

  • Rename getScopedNodes -> getAllNodes. Rename to make way for new method below.
  • Add getFirstNode. Gets only the 1st matching host component.
  • Add containsNode. Validates that any given HTML node is within the sub-tree of a scope.

These APIs mainly aim at adding missing functionality that would result in computationally expensive work-arounds in user-land.

@sizebot
Copy link

sizebot commented Oct 8, 2019

ReactDOM: size: 0.0%, gzip: 0.0%

Details of bundled changes.

Comparing: 5a71cbe...91616c9

react-art

File Filesize Diff Gzip Diff Prev Size Current Size Prev Gzip Current Gzip ENV
react-art.development.js +0.2% +0.1% 667.66 KB 669.08 KB 145.21 KB 145.4 KB UMD_DEV
react-art.production.min.js 0.0% 0.0% 103.65 KB 103.65 KB 31.52 KB 31.53 KB UMD_PROD
react-art.development.js +0.2% +0.2% 598.29 KB 599.71 KB 127.79 KB 127.99 KB NODE_DEV
react-art.production.min.js 0.0% 0.0% 68.67 KB 68.67 KB 20.82 KB 20.82 KB NODE_PROD
ReactART-dev.js +0.2% +0.1% 612.92 KB 614.38 KB 127.59 KB 127.78 KB FB_WWW_DEV
ReactART-prod.js 🔺+0.4% 🔺+0.4% 230.59 KB 231.54 KB 38.94 KB 39.1 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% 140.87 KB 140.87 KB 36.91 KB 36.91 KB UMD_DEV
ReactDOM-dev.js +0.2% +0.1% 971.29 KB 972.8 KB 215.53 KB 215.74 KB FB_WWW_DEV
react-dom-server.browser.production.min.js 0.0% 0.0% 19.86 KB 19.86 KB 7.37 KB 7.37 KB UMD_PROD
react-dom-test-utils.development.js 0.0% 0.0% 56.94 KB 56.94 KB 15.7 KB 15.7 KB UMD_DEV
react-dom-unstable-fizz.browser.development.js 0.0% +0.1% 3.78 KB 3.78 KB 1.53 KB 1.53 KB UMD_DEV
react-dom-test-utils.production.min.js 0.0% 0.0% 11.19 KB 11.19 KB 4.16 KB 4.16 KB UMD_PROD
react-dom-unstable-fizz.browser.production.min.js 0.0% 🔺+0.1% 1.2 KB 1.2 KB 701 B 702 B UMD_PROD
react-dom-test-utils.development.js 0.0% 0.0% 55.21 KB 55.21 KB 15.37 KB 15.37 KB NODE_DEV
react-dom-unstable-fizz.browser.development.js 0.0% +0.1% 3.61 KB 3.61 KB 1.48 KB 1.48 KB NODE_DEV
react-dom-test-utils.production.min.js 0.0% 0.0% 10.96 KB 10.96 KB 4.09 KB 4.09 KB NODE_PROD
react-dom-unstable-fizz.browser.production.min.js 0.0% 🔺+0.2% 1.04 KB 1.04 KB 632 B 633 B NODE_PROD
react-dom.development.js +0.2% +0.1% 947.08 KB 948.52 KB 214.4 KB 214.61 KB UMD_DEV
react-dom.production.min.js 0.0% 0.0% 115.72 KB 115.72 KB 37.24 KB 37.24 KB UMD_PROD
react-dom.profiling.min.js 0.0% 0.0% 119.24 KB 119.24 KB 38.35 KB 38.35 KB UMD_PROFILING
react-dom.development.js +0.2% +0.1% 941.15 KB 942.59 KB 212.83 KB 213.03 KB NODE_DEV
ReactDOM-prod.js 🔺+0.3% 🔺+0.3% 395.93 KB 397.11 KB 72.17 KB 72.39 KB FB_WWW_PROD
ReactDOM-profiling.js +0.3% +0.3% 396.74 KB 397.92 KB 72.69 KB 72.91 KB FB_WWW_PROFILING
react-dom-unstable-native-dependencies.development.js 0.0% 0.0% 60.53 KB 60.53 KB 15.83 KB 15.84 KB UMD_DEV
react-dom-unstable-native-dependencies.production.min.js 0.0% 🔺+0.1% 10.75 KB 10.75 KB 3.67 KB 3.68 KB UMD_PROD
ReactDOMServer-dev.js 0.0% 0.0% 140.69 KB 140.69 KB 35.48 KB 35.48 KB FB_WWW_DEV
ReactDOMServer-prod.js 0.0% 0.0% 48.24 KB 48.24 KB 11.04 KB 11.04 KB FB_WWW_PROD
react-dom-unstable-native-dependencies.development.js 0.0% 0.0% 60.2 KB 60.2 KB 15.71 KB 15.71 KB NODE_DEV
react-dom-unstable-fizz.node.development.js 0.0% +0.1% 3.87 KB 3.87 KB 1.51 KB 1.51 KB NODE_DEV
react-dom-unstable-native-dependencies.production.min.js 0.0% 🔺+0.1% 10.49 KB 10.49 KB 3.57 KB 3.57 KB NODE_PROD
react-dom-unstable-fizz.node.production.min.js 0.0% 🔺+0.3% 1.1 KB 1.1 KB 666 B 668 B NODE_PROD

react-test-renderer

File Filesize Diff Gzip Diff Prev Size Current Size Prev Gzip Current Gzip ENV
ReactTestRenderer-dev.js +0.2% +0.2% 624.19 KB 625.7 KB 130.03 KB 130.25 KB FB_WWW_DEV
react-test-renderer-shallow.development.js 0.0% 0.0% 38.96 KB 38.96 KB 9.94 KB 9.94 KB UMD_DEV
react-test-renderer-shallow.production.min.js 0.0% 🔺+0.1% 11.45 KB 11.45 KB 3.54 KB 3.54 KB UMD_PROD
react-test-renderer-shallow.production.min.js 0.0% 🔺+0.1% 11.6 KB 11.6 KB 3.64 KB 3.64 KB NODE_PROD
react-test-renderer.development.js +0.2% +0.2% 611.85 KB 613.32 KB 130.62 KB 130.84 KB UMD_DEV
react-test-renderer.production.min.js 0.0% 🔺+0.1% 70.6 KB 70.62 KB 21.62 KB 21.63 KB UMD_PROD
react-test-renderer.development.js +0.2% +0.2% 607.12 KB 608.59 KB 129.44 KB 129.66 KB NODE_DEV
react-test-renderer.production.min.js 0.0% 🔺+0.1% 70.3 KB 70.33 KB 21.3 KB 21.31 KB NODE_PROD

react-reconciler

File Filesize Diff Gzip Diff Prev Size Current Size Prev Gzip Current Gzip ENV
react-reconciler.development.js +0.2% +0.2% 599.27 KB 600.67 KB 126.97 KB 127.16 KB NODE_DEV
react-reconciler.production.min.js 0.0% 0.0% 71.39 KB 71.39 KB 21.1 KB 21.1 KB NODE_PROD
react-reconciler-reflection.development.js 0.0% 0.0% 19.76 KB 19.76 KB 6.39 KB 6.39 KB NODE_DEV
react-reconciler-reflection.production.min.js 0.0% 🔺+0.1% 2.88 KB 2.88 KB 1.25 KB 1.25 KB NODE_PROD
react-reconciler-persistent.development.js +0.2% +0.2% 596.44 KB 597.84 KB 125.78 KB 125.97 KB NODE_DEV

react-native-renderer

File Filesize Diff Gzip Diff Prev Size Current Size Prev Gzip Current Gzip ENV
ReactNativeRenderer-prod.js 0.0% 0.0% 275.3 KB 275.3 KB 47.04 KB 47.04 KB RN_OSS_PROD
ReactFabric-dev.js +0.2% +0.1% 749.81 KB 751.27 KB 158.71 KB 158.9 KB RN_FB_DEV
ReactFabric-prod.js 0.0% 0.0% 266.52 KB 266.52 KB 45.65 KB 45.65 KB RN_FB_PROD
ReactNativeRenderer-dev.js +0.2% +0.1% 745.33 KB 746.79 KB 158 KB 158.19 KB RN_OSS_DEV
ReactNativeRenderer-dev.js +0.2% +0.1% 745.49 KB 746.95 KB 158.07 KB 158.26 KB RN_FB_DEV
ReactFabric-dev.js +0.2% +0.1% 749.64 KB 751.1 KB 158.63 KB 158.82 KB RN_OSS_DEV

Generated by 🚫 dangerJS against 91616c9

Copy link

@germtb germtb left a comment

Choose a reason for hiding this comment

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

Looks good to me!

Copy link
Contributor

@necolas necolas left a comment

Choose a reason for hiding this comment

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

scope.getAllScopedNodes(): probably don't need Scoped in the method names too

@trueadm trueadm merged commit b71ab61 into facebook:master Oct 8, 2019
@trueadm trueadm deleted the more-scope-methods branch October 8, 2019 17:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants