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

Fixed invalid DevTools work tags #20362

Merged
merged 2 commits into from Dec 1, 2020
Merged

Conversation

@bvaughn
Copy link
Contributor

@bvaughn bvaughn commented Dec 1, 2020

Work tags changed recently (PR #13902) but we didn't bump React versions. This meant that DevTools has valid work tags only for master (and FB www sync) but invalid work tags for the latest open source releases. To fix this, I incremented React's version in Git (without an actual release) and added a new fork to the work tags detection branch.

This commit also add explicit tags for a few missing types (Fundamental, Lazy, LegacyHidden, Offscreen, and Scope) so meaningful names will be shown rather than "Unknown". (Technically Fundamental and Scope APIs were first introduced to experimental builds ~16.9 but I didn't add a new branch to the work tags fork because I don't they're used commonly. I've just added them to the 17+ branches.)

"build-for-devtools-dev": "cross-env RELEASE_CHANNEL=experimental yarn build react/index,react-dom/index,react-is,react-debug-tools,scheduler,react-test-renderer,react-refresh --type=NODE_DEV",
"build-for-devtools-prod": "cross-env RELEASE_CHANNEL=experimental yarn build react/index,react-dom/index,react-is,react-debug-tools,scheduler,react-test-renderer,react-refresh --type=NODE_PROD",
"build-for-devtools-dev": "cross-env RELEASE_CHANNEL=experimental yarn build react/index,react-dom,react-is,react-debug-tools,scheduler,react-test-renderer,react-refresh --type=NODE_DEV",
"build-for-devtools-prod": "cross-env RELEASE_CHANNEL=experimental yarn build react/index,react-dom,react-is,react-debug-tools,scheduler,react-test-renderer,react-refresh --type=NODE_PROD",

This comment has been minimized.

@bvaughn

bvaughn Dec 1, 2020
Author Contributor

react-dom/index wouldn't build test utils, which DevTools tests need.

//
// TODO Update the gt() check below to be gte() whichever the next version number is.
// Currently the version in Git is 17.0.2 (but that version has not been/may not end up being released).
if (gt(version, '17.0.1')) {

This comment has been minimized.

@bvaughn

bvaughn Dec 1, 2020
Author Contributor

We could probably leave the gt() check as-is, but I think gte() is better because it's more explicit. Also if we next released 17.1.0 next, and then went back and bug fix released 17.0.2 from a fork of 17.0.1 (unlikely but possible) this gt() check would fail.

Work tags changed recently (PR #13902) but we didn't bump React versions. This meant that DevTools has valid work tags only for master (and FB www sync) but invalid work tags for the latest open source releases. To fix this, I incremneted React's version in Git (without an actual release) and added a new fork to the work tags detection branch.

This commit also adds tags for the experimental Scope and Fundamental APIs to DevTools so component names will at least display correctly. Technically these new APIs were first introduced to experimental builds ~16.9 but I didn't add a new branch to the work tags fork because I don't they're used commonly. I've just added them to the 17+ branches.
@bvaughn bvaughn force-pushed the bvaughn:devtools-fix-work-tags branch from 843c1ba to cfc3565 Dec 1, 2020
@@ -354,11 +403,21 @@ export function getInternalReactConstants(
case HostText:
case Fragment:
return null;
case FundamentalComponent:
return 'Fundamental';

This comment has been minimized.

@bvaughn

bvaughn Dec 1, 2020
Author Contributor

There's more work to do to fully support APIs like fundamental and scope, but as long as they exist and are being used within Facebook– at least now they won't show up as "Unknown" in DevTools.

PS I assume we still intend to use both APIs? I haven't been following along with either TBH.

This comment has been minimized.

@gaearon

gaearon Dec 1, 2020
Member

I don't think we ever used Fundamental. It's dead code.

This comment has been minimized.

@bvaughn

bvaughn Dec 1, 2020
Author Contributor

Excellent. Thanks.

@bvaughn bvaughn mentioned this pull request Dec 1, 2020
@codesandbox
Copy link

@codesandbox codesandbox bot commented Dec 1, 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 127381d:

Sandbox Source
React Configuration
@sizebot
Copy link

@sizebot sizebot commented Dec 1, 2020

Details of bundled changes.

Comparing: 2cf8f7f...127381d

react-dom

File Filesize Diff Gzip Diff Prev Size Current Size Prev Gzip Current Gzip ENV
react-dom.development.js 0.0% +0.1% 949.05 KB 949.31 KB 208.09 KB 208.21 KB UMD_DEV
react-dom-server.browser.development.js +0.2% +0.3% 136.96 KB 137.21 KB 36.27 KB 36.4 KB NODE_DEV
react-dom-test-utils.development.js 0.0% -0.0% 71.29 KB 71.29 KB 19.31 KB 19.31 KB UMD_DEV
ReactDOMServer-dev.js +0.2% +0.3% 141.4 KB 141.65 KB 36.3 KB 36.43 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
ReactDOMServer-prod.js 0.0% -0.0% 46.28 KB 46.28 KB 10.79 KB 10.79 KB FB_WWW_PROD
react-dom-test-utils.development.js 0.0% 0.0% 66.11 KB 66.11 KB 18.79 KB 18.8 KB NODE_DEV
ReactDOMTesting-dev.js 0.0% +0.1% 906.79 KB 907.03 KB 204.26 KB 204.37 KB FB_WWW_DEV
react-dom-test-utils.production.min.js 0.0% -0.0% 13.7 KB 13.7 KB 5.27 KB 5.26 KB NODE_PROD
react-dom.production.min.js 0.0% -0.0% 121.32 KB 121.32 KB 39.87 KB 39.87 KB UMD_PROD
react-dom.profiling.min.js 0.0% 0.0% 126.64 KB 126.64 KB 41.52 KB 41.53 KB UMD_PROFILING
react-dom.development.js 0.0% +0.1% 903.13 KB 903.37 KB 205.52 KB 205.63 KB NODE_DEV
ReactDOMForked-dev.js 0.0% +0.1% 953.61 KB 953.85 KB 213.14 KB 213.25 KB FB_WWW_DEV
react-dom-unstable-fizz.browser.production.min.js 0.0% -0.1% 1.22 KB 1.22 KB 713 B 712 B UMD_PROD
react-dom.production.min.js 0.0% -0.0% 121.49 KB 121.49 KB 39.11 KB 39.11 KB NODE_PROD
ReactDOMForked-profiling.js 0.0% -0.0% 382.96 KB 382.96 KB 71.05 KB 71.05 KB FB_WWW_PROFILING
ReactDOM-dev.js 0.0% +0.1% 954.17 KB 954.42 KB 213.44 KB 213.56 KB FB_WWW_DEV
ReactDOM-prod.js 0.0% -0.0% 366.76 KB 366.76 KB 68.17 KB 68.17 KB FB_WWW_PROD
ReactDOM-profiling.js 0.0% -0.0% 383.19 KB 383.19 KB 71.17 KB 71.16 KB FB_WWW_PROFILING
react-dom-server.browser.development.js +0.2% +0.3% 144.37 KB 144.62 KB 36.71 KB 36.83 KB UMD_DEV
react-dom-server.node.development.js +0.2% +0.3% 138.23 KB 138.48 KB 36.52 KB 36.65 KB NODE_DEV

react-art

File Filesize Diff Gzip Diff Prev Size Current Size Prev Gzip Current Gzip ENV
react-art.development.js 0.0% +0.1% 587.8 KB 588.05 KB 128 KB 128.1 KB NODE_DEV
ReactART-dev.js 0.0% +0.1% 621.43 KB 621.68 KB 132.34 KB 132.46 KB FB_WWW_DEV
react-art.development.js 0.0% +0.1% 686.44 KB 686.69 KB 145.82 KB 145.93 KB UMD_DEV

react-native-renderer

File Filesize Diff Gzip Diff Prev Size Current Size Prev Gzip Current Gzip ENV
ReactNativeRenderer-dev.js 0.0% +0.1% 675.56 KB 675.81 KB 146.54 KB 146.64 KB RN_OSS_DEV
ReactNativeRenderer-prod.js 0.0% -0.0% 267.39 KB 267.39 KB 47.73 KB 47.73 KB RN_OSS_PROD
ReactFabric-dev.js 0.0% +0.1% 656.31 KB 656.56 KB 141.88 KB 141.99 KB RN_OSS_DEV
ReactFabric-prod.js 0.0% -0.0% 261.21 KB 261.21 KB 46.46 KB 46.46 KB RN_OSS_PROD
ReactFabric-profiling.js 0.0% -0.0% 272.59 KB 272.59 KB 48.67 KB 48.67 KB RN_OSS_PROFILING

react-test-renderer

File Filesize Diff Gzip Diff Prev Size Current Size Prev Gzip Current Gzip ENV
react-test-renderer.development.js 0.0% +0.1% 603.74 KB 604 KB 127.21 KB 127.31 KB UMD_DEV
react-test-renderer.development.js 0.0% +0.1% 575.12 KB 575.36 KB 125.76 KB 125.86 KB NODE_DEV
react-test-renderer.production.min.js 0.0% -0.0% 75.97 KB 75.97 KB 23.68 KB 23.68 KB NODE_PROD
ReactTestRenderer-dev.js 0.0% +0.1% 590.15 KB 590.4 KB 126.85 KB 126.95 KB FB_WWW_DEV
ReactTestRenderer-dev.js 0.0% +0.1% 584.8 KB 585.04 KB 126.62 KB 126.72 KB RN_FB_DEV
ReactTestRenderer-profiling.js 0.0% -0.0% 239.84 KB 239.84 KB 43.89 KB 43.89 KB RN_FB_PROFILING

react

File Filesize Diff Gzip Diff Prev Size Current Size Prev Gzip Current Gzip ENV
React-profiling.js 0.0% -0.0% 16.23 KB 16.23 KB 4.23 KB 4.22 KB FB_WWW_PROFILING
React-dev.js +0.3% +0.6% 86.46 KB 86.71 KB 20.75 KB 20.87 KB RN_FB_DEV
React-prod.js 0.0% -0.0% 16.49 KB 16.49 KB 4.38 KB 4.38 KB RN_FB_PROD
react-unstable-cache.profiling.min.js 0.0% +0.2% 866 B 866 B 562 B 563 B NODE_PROFILING
React-profiling.js 0.0% -0.0% 16.49 KB 16.49 KB 4.38 KB 4.38 KB RN_FB_PROFILING
react-jsx-dev-runtime.development.js 0.0% -0.0% 36.9 KB 36.9 KB 10.66 KB 10.66 KB NODE_DEV
react-jsx-dev-runtime.production.min.js 0.0% 🔺+0.3% 478 B 478 B 330 B 331 B NODE_PROD
react-jsx-runtime.development.js 0.0% -0.0% 37.48 KB 37.48 KB 10.83 KB 10.83 KB NODE_DEV
react.development.js +0.2% +0.4% 108.3 KB 108.55 KB 26.5 KB 26.61 KB UMD_DEV
react-unstable-index.server.development.js +0.4% +0.7% 65.42 KB 65.66 KB 17.81 KB 17.93 KB NODE_DEV
react.development.js +0.3% +0.6% 71.94 KB 72.18 KB 19.28 KB 19.4 KB NODE_DEV
React-dev.js +0.3% +0.5% 94.59 KB 94.84 KB 23.07 KB 23.19 KB FB_WWW_DEV
React-prod.js 0.0% -0.0% 16.23 KB 16.23 KB 4.23 KB 4.22 KB FB_WWW_PROD

react-reconciler

File Filesize Diff Gzip Diff Prev Size Current Size Prev Gzip Current Gzip ENV
react-reconciler.development.js 0.0% +0.1% 645.16 KB 645.41 KB 137.96 KB 138.06 KB NODE_DEV

Size changes (experimental)

Generated by 🚫 dangerJS against 127381d

@sizebot
Copy link

@sizebot sizebot commented Dec 1, 2020

Details of bundled changes.

Comparing: 2cf8f7f...127381d

react-dom

File Filesize Diff Gzip Diff Prev Size Current Size Prev Gzip Current Gzip ENV
react-dom.development.js 0.0% +0.1% 915.02 KB 915.28 KB 201.84 KB 201.95 KB UMD_DEV
react-dom-server.browser.production.min.js 0.0% -0.0% 19.82 KB 19.82 KB 7.44 KB 7.44 KB UMD_PROD
react-dom-server.browser.development.js +0.2% +0.3% 135.45 KB 135.69 KB 36.06 KB 36.18 KB NODE_DEV
react-dom-test-utils.development.js 0.0% -0.0% 71.28 KB 71.28 KB 19.3 KB 19.3 KB UMD_DEV
ReactDOMServer-dev.js +0.2% +0.3% 145.43 KB 145.68 KB 37.31 KB 37.44 KB FB_WWW_DEV
react-dom-test-utils.development.js 0.0% 0.0% 66.1 KB 66.1 KB 18.79 KB 18.79 KB NODE_DEV
ReactDOMTesting-dev.js 0.0% +0.1% 935.13 KB 935.37 KB 209.77 KB 209.88 KB FB_WWW_DEV
ReactDOMTesting-prod.js 0.0% -0.0% 381.38 KB 381.38 KB 72 KB 72 KB FB_WWW_PROD
react-dom.profiling.min.js 0.0% -0.0% 121.37 KB 121.37 KB 39.82 KB 39.82 KB UMD_PROFILING
react-dom.development.js 0.0% +0.1% 870.71 KB 870.95 KB 199.31 KB 199.42 KB NODE_DEV
ReactDOMForked-dev.js 0.0% 0.0% 979.19 KB 979.43 KB 217.95 KB 218.05 KB FB_WWW_DEV
ReactDOMForked-prod.js 0.0% -0.0% 377.87 KB 377.87 KB 69.92 KB 69.92 KB FB_WWW_PROD
ReactDOMForked-profiling.js 0.0% -0.0% 394.35 KB 394.35 KB 72.9 KB 72.9 KB FB_WWW_PROFILING
ReactDOM-dev.js 0.0% +0.1% 979.75 KB 980 KB 218.15 KB 218.27 KB FB_WWW_DEV
ReactDOM-prod.js 0.0% -0.0% 378.1 KB 378.1 KB 69.94 KB 69.94 KB FB_WWW_PROD
ReactDOM-profiling.js 0.0% -0.0% 394.58 KB 394.58 KB 72.94 KB 72.94 KB FB_WWW_PROFILING
react-dom-server.browser.development.js +0.2% +0.3% 142.78 KB 143.04 KB 36.51 KB 36.64 KB UMD_DEV
react-dom-server.node.development.js +0.2% +0.3% 136.72 KB 136.96 KB 36.31 KB 36.43 KB NODE_DEV

react-art

File Filesize Diff Gzip Diff Prev Size Current Size Prev Gzip Current Gzip ENV
react-art.development.js 0.0% +0.1% 565.29 KB 565.54 KB 123.4 KB 123.5 KB NODE_DEV
ReactART-dev.js 0.0% +0.1% 631.44 KB 631.69 KB 134.37 KB 134.49 KB FB_WWW_DEV
ReactART-prod.js 0.0% -0.0% 237.08 KB 237.08 KB 42.12 KB 42.12 KB FB_WWW_PROD
react-art.development.js 0.0% +0.1% 662.81 KB 663.07 KB 141.17 KB 141.28 KB UMD_DEV

react-native-renderer

File Filesize Diff Gzip Diff Prev Size Current Size Prev Gzip Current Gzip ENV
ReactNativeRenderer-dev.js 0.0% +0.1% 675.55 KB 675.8 KB 146.53 KB 146.63 KB RN_OSS_DEV
ReactFabric-dev.js 0.0% +0.1% 661.7 KB 661.95 KB 142.76 KB 142.86 KB RN_FB_DEV
ReactNativeRenderer-prod.js 0.0% -0.0% 267.38 KB 267.38 KB 47.72 KB 47.72 KB RN_OSS_PROD
ReactFabric-profiling.js 0.0% -0.0% 272.54 KB 272.54 KB 48.64 KB 48.64 KB RN_FB_PROFILING
ReactNativeRenderer-dev.js 0.0% +0.1% 680.95 KB 681.19 KB 147.4 KB 147.5 KB RN_FB_DEV
ReactFabric-dev.js 0.0% +0.1% 656.3 KB 656.54 KB 141.87 KB 141.98 KB RN_OSS_DEV
ReactFabric-profiling.js 0.0% -0.0% 272.58 KB 272.58 KB 48.66 KB 48.66 KB RN_OSS_PROFILING

react-test-renderer

File Filesize Diff Gzip Diff Prev Size Current Size Prev Gzip Current Gzip ENV
react-test-renderer.development.js 0.0% +0.1% 603.72 KB 603.97 KB 127.19 KB 127.29 KB UMD_DEV
react-test-renderer.development.js 0.0% +0.1% 575.09 KB 575.34 KB 125.74 KB 125.84 KB NODE_DEV
react-test-renderer.production.min.js 0.0% -0.0% 75.95 KB 75.95 KB 23.66 KB 23.66 KB NODE_PROD
ReactTestRenderer-dev.js 0.0% +0.1% 590.14 KB 590.39 KB 126.84 KB 126.93 KB FB_WWW_DEV
ReactTestRenderer-dev.js 0.0% +0.1% 584.79 KB 585.03 KB 126.61 KB 126.71 KB RN_FB_DEV
ReactTestRenderer-profiling.js 0.0% -0.0% 239.83 KB 239.83 KB 43.88 KB 43.88 KB RN_FB_PROFILING

react

File Filesize Diff Gzip Diff Prev Size Current Size Prev Gzip Current Gzip ENV
React-dev.js +0.3% +0.6% 87.45 KB 87.7 KB 20.98 KB 21.1 KB RN_FB_DEV
React-prod.js 0.0% 0.0% 16.63 KB 16.63 KB 4.43 KB 4.43 KB RN_FB_PROD
React-profiling.js 0.0% 0.0% 16.63 KB 16.63 KB 4.43 KB 4.43 KB RN_FB_PROFILING
react-jsx-dev-runtime.development.js 0.0% -0.0% 36.88 KB 36.88 KB 10.66 KB 10.66 KB NODE_DEV
react-jsx-dev-runtime.production.min.js 0.0% 🔺+0.3% 465 B 465 B 321 B 322 B NODE_PROD
react-jsx-runtime.development.js 0.0% -0.0% 37.47 KB 37.47 KB 10.83 KB 10.83 KB NODE_DEV
react.development.js +0.2% +0.5% 106.75 KB 107 KB 26.24 KB 26.36 KB UMD_DEV
react.production.min.js 0.0% -0.0% 10.77 KB 10.77 KB 4.34 KB 4.34 KB UMD_PROD
react.development.js +0.3% +0.6% 70.47 KB 70.72 KB 19.02 KB 19.14 KB NODE_DEV
React-dev.js +0.3% +0.5% 95.58 KB 95.83 KB 23.3 KB 23.42 KB FB_WWW_DEV

ReactDOM: size: 0.0%, gzip: -0.0%

React: size: 0.0%, gzip: -0.0%

Size changes (stable)

Generated by 🚫 dangerJS against 127381d

case FundamentalComponent:
return 'Fundamental';
case LazyComponent:
return 'Lazy';

This comment has been minimized.

@gaearon

gaearon Dec 1, 2020
Member

Should this not show the inner type? Or does it mean it hasn't yet resolved?

This comment has been minimized.

@bvaughn

bvaughn Dec 1, 2020
Author Contributor

I think it means it hasn't resolved yet. Once it resolves, it will be replaced with the inner component:

// Store the unwrapped component in the type.
workInProgress.type = Component;
const resolvedTag = (workInProgress.tag = resolveLazyComponentTag(Component));

So this label likely wouldn't be user-visible, but could show up in the console logs if we enabled the DevTools DEBUG flag for example.

I actually noticed this while tracking down what I think may be a bug with Lazy (if you unmount a Lazy component before it resolves, React ends up telling DevTools to unmount something that was never mounted and DevTools throws). I'll push a fix for that in a stacked PR shortly. Writing some more tests for it now.

@gaearon
gaearon approved these changes Dec 1, 2020
Copy link
Member

@gaearon gaearon left a comment

You can remove Fundamental there.

@bvaughn bvaughn merged commit a2a0255 into facebook:master Dec 1, 2020
34 checks passed
34 checks passed
Facebook CLA Check Contributor License Agreement is valid!
Details
ci/circleci: RELEASE_CHANNEL_stable_yarn_build Your tests passed on CircleCI!
Details
ci/circleci: RELEASE_CHANNEL_stable_yarn_lint_build Your tests passed on CircleCI!
Details
ci/circleci: RELEASE_CHANNEL_stable_yarn_test_dom_fixtures Your tests passed on CircleCI!
Details
ci/circleci: build_devtools_and_process_artifacts Your tests passed on CircleCI!
Details
ci/circleci: build_devtools_scheduling_profiler Your tests passed on CircleCI!
Details
ci/circleci: process_artifacts Your tests passed on CircleCI!
Details
ci/circleci: process_artifacts_experimental Your tests passed on CircleCI!
Details
ci/circleci: setup Your tests passed on CircleCI!
Details
ci/circleci: sizebot_experimental Your tests passed on CircleCI!
Details
ci/circleci: sizebot_stable Your tests passed on CircleCI!
Details
ci/circleci: yarn_build Your tests passed on CircleCI!
Details
ci/circleci: yarn_flow Your tests passed on CircleCI!
Details
ci/circleci: yarn_lint Your tests passed on CircleCI!
Details
ci/circleci: yarn_lint_build Your tests passed on CircleCI!
Details
ci/circleci: yarn_test Your tests passed on CircleCI!
Details
ci/circleci: yarn_test-classic Your tests passed on CircleCI!
Details
ci/circleci: yarn_test-classic_prod Your tests passed on CircleCI!
Details
ci/circleci: yarn_test-classic_prod_variant Your tests passed on CircleCI!
Details
ci/circleci: yarn_test-classic_variant Your tests passed on CircleCI!
Details
ci/circleci: yarn_test-stable Your tests passed on CircleCI!
Details
ci/circleci: yarn_test-stable_build Your tests passed on CircleCI!
Details
ci/circleci: yarn_test-stable_build_prod Your tests passed on CircleCI!
Details
ci/circleci: yarn_test-stable_persistent Your tests passed on CircleCI!
Details
ci/circleci: yarn_test-stable_prod Your tests passed on CircleCI!
Details
ci/circleci: yarn_test-www Your tests passed on CircleCI!
Details
ci/circleci: yarn_test-www_prod Your tests passed on CircleCI!
Details
ci/circleci: yarn_test-www_prod_variant Your tests passed on CircleCI!
Details
ci/circleci: yarn_test-www_variant Your tests passed on CircleCI!
Details
ci/circleci: yarn_test_build Your tests passed on CircleCI!
Details
ci/circleci: yarn_test_build_devtools Your tests passed on CircleCI!
Details
ci/circleci: yarn_test_build_prod Your tests passed on CircleCI!
Details
ci/circleci: yarn_test_prod Your tests passed on CircleCI!
Details
ci/codesandbox Building packages succeeded.
Details
@bvaughn bvaughn deleted the bvaughn:devtools-fix-work-tags branch Dec 1, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

4 participants
You can’t perform that action at this time.