Skip to content

Conversation

sebmarkbage
Copy link
Collaborator

Currently we're inconsistently handling tags that are only relevant for certain flags. We should throw if the tag is not part of the built feature flags. This should also mean that the case statements can be eliminated.

We can achieve this effect by putting the invariant outside of the switch and always early return in the switch. We already do this in beginWork. This PR makes this consistent in other places.

Currently we're inconsistently handling tags that are only relevant
for certain flags. We should throw if the tag is not part of the built
feature flags. This should also mean that the case statements can be
eliminated.

We can achieve this effect by putting the invariant outside of the switch
and always early return in the switch. We already do this in beginWork.
This PR makes this consistent in other places.
@codesandbox-ci
Copy link

codesandbox-ci bot commented Dec 18, 2019

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

Sandbox Source
solitary-sun-kykub Configuration

@sizebot
Copy link

sizebot commented Dec 18, 2019

Details of bundled changes.

Comparing: 9fe1031...c692979

react-test-renderer

File Filesize Diff Gzip Diff Prev Size Current Size Prev Gzip Current Gzip ENV
react-test-renderer.development.js -0.1% -0.0% 611.89 KB 611.58 KB 130.8 KB 130.74 KB UMD_DEV
react-test-renderer.production.min.js -0.0% -0.2% 71.22 KB 71.19 KB 21.91 KB 21.88 KB UMD_PROD
react-test-renderer-shallow.development.js 0.0% 0.0% 37.68 KB 37.68 KB 9.78 KB 9.78 KB UMD_DEV
react-test-renderer-shallow.production.min.js 0.0% 0.0% 11.6 KB 11.6 KB 3.58 KB 3.58 KB UMD_PROD
react-test-renderer-shallow.development.js 0.0% 0.0% 32.22 KB 32.22 KB 8.47 KB 8.47 KB NODE_DEV
react-test-renderer-shallow.production.min.js 0.0% 0.0% 11.73 KB 11.73 KB 3.69 KB 3.69 KB NODE_PROD
react-test-renderer.development.js -0.1% -0.0% 607.16 KB 606.85 KB 129.62 KB 129.56 KB NODE_DEV
react-test-renderer.production.min.js -0.1% -0.4% 70.93 KB 70.88 KB 21.55 KB 21.46 KB NODE_PROD
ReactTestRenderer-dev.js -0.0% -0.0% 622.73 KB 622.45 KB 130.37 KB 130.32 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.0% -0.0% 739.66 KB 739.43 KB 157.12 KB 157.08 KB RN_OSS_DEV
ReactFabric-dev.js -0.0% -0.0% 730.22 KB 729.99 KB 154.87 KB 154.84 KB RN_OSS_DEV
ReactNativeRenderer-dev.js -0.0% -0.0% 739.84 KB 739.6 KB 157.21 KB 157.17 KB RN_FB_DEV
ReactFabric-prod.js -0.6% -0.6% 266.44 KB 264.74 KB 45.93 KB 45.63 KB RN_OSS_PROD
ReactNativeRenderer-prod.js -1.1% -1.0% 275.66 KB 272.72 KB 47.46 KB 46.97 KB RN_FB_PROD
ReactFabric-profiling.js -0.2% -0.1% 276.55 KB 275.86 KB 47.79 KB 47.76 KB RN_OSS_PROFILING
ReactNativeRenderer-profiling.js -0.2% -0.2% 284.58 KB 283.89 KB 49.19 KB 49.11 KB RN_FB_PROFILING
ReactNativeRenderer-prod.js -1.1% -1.0% 275.27 KB 272.33 KB 47.39 KB 46.9 KB RN_OSS_PROD
ReactFabric-dev.js -0.0% -0.0% 730.41 KB 730.17 KB 154.96 KB 154.93 KB RN_FB_DEV
ReactNativeRenderer-profiling.js -0.2% -0.2% 284.2 KB 283.51 KB 49.12 KB 49.04 KB RN_OSS_PROFILING
ReactFabric-prod.js -0.6% -0.6% 266.79 KB 265.08 KB 46 KB 45.7 KB RN_FB_PROD
ReactFabric-profiling.js -0.2% -0.1% 276.9 KB 276.21 KB 47.86 KB 47.82 KB RN_FB_PROFILING

react-dom

File Filesize Diff Gzip Diff Prev Size Current Size Prev Gzip Current Gzip ENV
react-dom.profiling.min.js -0.1% -0.2% 123.07 KB 122.96 KB 38.8 KB 38.72 KB NODE_PROFILING
react-dom-server.browser.development.js 0.0% 0.0% 137.55 KB 137.55 KB 36.57 KB 36.57 KB UMD_DEV
react-dom-server.browser.production.min.js 0.0% 0.0% 20.39 KB 20.39 KB 7.48 KB 7.48 KB UMD_PROD
react-dom-test-utils.development.js 0.0% 0.0% 54.47 KB 54.47 KB 15.31 KB 15.31 KB UMD_DEV
ReactDOMServer-prod.js 0.0% 0.0% 48.86 KB 48.86 KB 11.16 KB 11.16 KB FB_WWW_PROD
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.production.min.js 0.0% 🔺+0.1% 1.21 KB 1.21 KB 710 B 711 B 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-unstable-fizz.browser.production.min.js 0.0% 🔺+0.2% 1.05 KB 1.05 KB 641 B 642 B NODE_PROD
react-dom.development.js -0.0% -0.0% 947.38 KB 947.06 KB 214.91 KB 214.84 KB UMD_DEV
react-dom.production.min.js -0.1% -0.3% 119.12 KB 118.99 KB 38.43 KB 38.3 KB UMD_PROD
react-dom.profiling.min.js -0.1% -0.2% 122.81 KB 122.73 KB 39.49 KB 39.42 KB UMD_PROFILING
react-dom.development.js -0.0% -0.0% 941.44 KB 941.13 KB 213.26 KB 213.19 KB NODE_DEV
react-dom-server.node.development.js 0.0% 0.0% 134.59 KB 134.59 KB 35.78 KB 35.78 KB NODE_DEV
react-dom.production.min.js -0.2% -0.6% 119.27 KB 119.08 KB 37.81 KB 37.58 KB NODE_PROD
react-dom-server.browser.development.js 0.0% 0.0% 133.48 KB 133.48 KB 35.55 KB 35.55 KB NODE_DEV
ReactDOM-dev.js -0.0% -0.0% 969.13 KB 968.85 KB 216.07 KB 216.04 KB FB_WWW_DEV
ReactDOM-prod.js -2.8% -2.2% 402.83 KB 391.47 KB 73.56 KB 71.95 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.1% 403.75 KB 402.77 KB 74.14 KB 74.07 KB FB_WWW_PROFILING
react-dom-unstable-native-dependencies.production.min.js 0.0% 🔺+0.1% 10.23 KB 10.23 KB 3.47 KB 3.48 KB UMD_PROD
react-dom-unstable-native-dependencies.development.js 0.0% 0.0% 60.61 KB 60.61 KB 16 KB 16 KB NODE_DEV
react-dom-unstable-fizz.node.development.js 0.0% -0.1% 4.42 KB 4.42 KB 1.65 KB 1.65 KB NODE_DEV
react-dom-unstable-native-dependencies.production.min.js 0.0% 🔺+0.1% 9.97 KB 9.97 KB 3.37 KB 3.37 KB NODE_PROD
react-dom-unstable-fizz.node.production.min.js 0.0% 🔺+0.1% 1.21 KB 1.21 KB 697 B 698 B NODE_PROD

react-art

File Filesize Diff Gzip Diff Prev Size Current Size Prev Gzip Current Gzip ENV
ReactART-dev.js -0.0% -0.0% 611.35 KB 611.08 KB 127.83 KB 127.79 KB FB_WWW_DEV
ReactART-prod.js -1.2% -1.1% 235.65 KB 232.83 KB 40.04 KB 39.59 KB FB_WWW_PROD
react-art.development.js -0.0% -0.0% 667.09 KB 666.78 KB 145.2 KB 145.14 KB UMD_DEV
react-art.production.min.js -0.0% -0.1% 106.19 KB 106.15 KB 32.35 KB 32.33 KB UMD_PROD
react-art.development.js -0.1% -0.1% 597.73 KB 597.42 KB 127.8 KB 127.74 KB NODE_DEV
react-art.production.min.js -0.1% -0.2% 71.16 KB 71.11 KB 21.5 KB 21.46 KB NODE_PROD

react-reconciler

File Filesize Diff Gzip Diff Prev Size Current Size Prev Gzip Current Gzip ENV
react-reconciler-persistent.development.js -0.1% -0.0% 596.2 KB 595.89 KB 125.85 KB 125.79 KB NODE_DEV
react-reconciler-persistent.production.min.js -0.2% -0.6% 71.97 KB 71.86 KB 21.31 KB 21.19 KB NODE_PROD
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.1% -0.0% 598.73 KB 598.42 KB 126.95 KB 126.89 KB NODE_DEV
react-reconciler.production.min.js -0.1% -0.5% 74.18 KB 74.08 KB 21.87 KB 21.75 KB NODE_PROD

ReactDOM: size: 0.0%, gzip: 0.0%

Size changes (experimental)

Generated by 🚫 dangerJS against c692979

@sizebot
Copy link

sizebot commented Dec 18, 2019

Details of bundled changes.

Comparing: 9fe1031...c692979

react-reconciler

File Filesize Diff Gzip Diff Prev Size Current Size Prev Gzip Current Gzip ENV
react-reconciler-persistent.production.min.js -0.2% -0.5% 71.95 KB 71.85 KB 21.3 KB 21.18 KB NODE_PROD
react-reconciler.development.js -0.1% -0.0% 598.72 KB 598.41 KB 126.95 KB 126.89 KB NODE_DEV
react-reconciler.production.min.js -0.2% -0.5% 71.94 KB 71.83 KB 21.29 KB 21.17 KB NODE_PROD
react-reconciler-reflection.production.min.js 0.0% 🔺+0.1% 2.85 KB 2.85 KB 1.24 KB 1.24 KB NODE_PROD
react-reconciler-persistent.development.js -0.1% -0.0% 596.19 KB 595.88 KB 125.84 KB 125.79 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.86 KB 19.86 KB 7.38 KB 7.38 KB NODE_PROD
react-dom.production.min.js -0.1% -0.4% 115.77 KB 115.63 KB 37.46 KB 37.32 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.profiling.min.js -0.1% -0.1% 119.35 KB 119.26 KB 38.53 KB 38.49 KB UMD_PROFILING
react-dom-unstable-native-dependencies.production.min.js 0.0% 🔺+0.1% 9.96 KB 9.96 KB 3.36 KB 3.37 KB NODE_PROD
react-dom.development.js -0.0% -0.0% 941.42 KB 941.11 KB 213.23 KB 213.17 KB NODE_DEV
react-dom.production.min.js -0.2% -0.6% 115.88 KB 115.7 KB 36.87 KB 36.66 KB NODE_PROD
react-dom.profiling.min.js -0.1% -0.1% 119.58 KB 119.46 KB 37.82 KB 37.78 KB NODE_PROFILING
react-dom-unstable-fizz.browser.production.min.js 0.0% 🔺+0.1% 1.2 KB 1.2 KB 702 B 703 B UMD_PROD
react-dom-server.browser.development.js 0.0% 0.0% 137.52 KB 137.52 KB 36.56 KB 36.57 KB UMD_DEV
react-dom-server.browser.production.min.js 0.0% 0.0% 19.93 KB 19.93 KB 7.38 KB 7.39 KB UMD_PROD
react-dom-unstable-fizz.browser.development.js 0.0% -0.1% 3.7 KB 3.7 KB 1.5 KB 1.49 KB NODE_DEV
react-dom-test-utils.development.js 0.0% 0.0% 54.46 KB 54.46 KB 15.3 KB 15.31 KB UMD_DEV
react-dom-unstable-fizz.browser.production.min.js 0.0% 🔺+0.2% 1.04 KB 1.04 KB 633 B 634 B NODE_PROD
react-dom-test-utils.production.min.js 0.0% 🔺+0.1% 11.17 KB 11.17 KB 4.14 KB 4.14 KB UMD_PROD
react-dom-server.browser.development.js 0.0% 0.0% 133.46 KB 133.46 KB 35.55 KB 35.55 KB NODE_DEV
react-dom-test-utils.production.min.js 0.0% 🔺+0.1% 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.07 KB UMD_DEV
react-dom-unstable-fizz.node.production.min.js 0.0% 🔺+0.1% 1.2 KB 1.2 KB 689 B 690 B NODE_PROD
react-dom-unstable-native-dependencies.production.min.js 0.0% 0.0% 10.22 KB 10.22 KB 3.47 KB 3.47 KB UMD_PROD
react-dom-server.node.development.js 0.0% 0.0% 134.57 KB 134.57 KB 35.78 KB 35.78 KB NODE_DEV
react-dom.development.js -0.0% -0.0% 947.36 KB 947.04 KB 214.88 KB 214.82 KB UMD_DEV
react-dom-server.node.production.min.js 0.0% 0.0% 20.27 KB 20.27 KB 7.53 KB 7.53 KB NODE_PROD

react-art

File Filesize Diff Gzip Diff Prev Size Current Size Prev Gzip Current Gzip ENV
react-art.production.min.js -0.0% -0.2% 104.17 KB 104.13 KB 31.83 KB 31.78 KB UMD_PROD
react-art.development.js -0.0% -0.0% 667.06 KB 666.75 KB 145.2 KB 145.14 KB UMD_DEV
react-art.development.js -0.1% -0.0% 597.71 KB 597.4 KB 127.79 KB 127.73 KB NODE_DEV
react-art.production.min.js -0.1% -0.3% 69.18 KB 69.13 KB 20.98 KB 20.92 KB NODE_PROD

react-native-renderer

File Filesize Diff Gzip Diff Prev Size Current Size Prev Gzip Current Gzip ENV
ReactFabric-dev.js -0.0% -0.0% 730.21 KB 729.98 KB 154.87 KB 154.83 KB RN_OSS_DEV
ReactFabric-prod.js -0.6% -0.6% 266.43 KB 264.72 KB 45.92 KB 45.63 KB RN_OSS_PROD
ReactNativeRenderer-dev.js -0.0% -0.0% 739.65 KB 739.41 KB 157.11 KB 157.07 KB RN_OSS_DEV
ReactFabric-profiling.js -0.2% -0.1% 276.54 KB 275.85 KB 47.79 KB 47.75 KB RN_OSS_PROFILING
ReactNativeRenderer-prod.js -1.1% -1.0% 275.25 KB 272.32 KB 47.38 KB 46.89 KB RN_OSS_PROD
ReactNativeRenderer-profiling.js -0.2% -0.2% 284.19 KB 283.49 KB 49.11 KB 49.03 KB RN_OSS_PROFILING

react-test-renderer

File Filesize Diff Gzip Diff Prev Size Current Size Prev Gzip Current Gzip ENV
react-test-renderer-shallow.development.js 0.0% 0.0% 37.67 KB 37.67 KB 9.77 KB 9.77 KB UMD_DEV
react-test-renderer-shallow.production.min.js 0.0% 0.0% 11.58 KB 11.58 KB 3.58 KB 3.58 KB UMD_PROD
react-test-renderer-shallow.production.min.js 0.0% 0.0% 11.72 KB 11.72 KB 3.68 KB 3.68 KB NODE_PROD
react-test-renderer.development.js -0.1% -0.0% 611.87 KB 611.55 KB 130.79 KB 130.73 KB UMD_DEV
react-test-renderer.production.min.js -0.0% -0.2% 71.19 KB 71.17 KB 21.9 KB 21.86 KB UMD_PROD
react-test-renderer.development.js -0.1% -0.0% 607.13 KB 606.82 KB 129.61 KB 129.55 KB NODE_DEV
react-test-renderer.production.min.js -0.1% -0.4% 70.9 KB 70.86 KB 21.53 KB 21.45 KB NODE_PROD

ReactDOM: size: -0.1%, gzip: -0.4%

Size changes (stable)

Generated by 🚫 dangerJS against c692979

@sebmarkbage sebmarkbage merged commit 4c27037 into facebook:master Dec 18, 2019
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.

4 participants