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

Removed 'reactInternal' reference in DevTools overlay highlighter #17841

Merged

Conversation

@bvaughn
Copy link
Contributor

bvaughn commented Jan 14, 2020

Verified observable behavior after this change matches behavior before.

Resolves #17822

@bvaughn bvaughn force-pushed the bvaughn:devtools-remove-reactInternal-reference branch from 31f9dfe to 70fecdf Jan 14, 2020
@codesandbox

This comment has been minimized.

Copy link

codesandbox 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 31f9dfe:

Sandbox Source
festive-beaver-5eg49 Configuration
@codesandbox

This comment has been minimized.

Copy link

codesandbox 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 70fecdf:

Sandbox Source
distracted-frog-7h09m Configuration

const node = elements[0];
const hook: DevToolsHook =
node.ownerDocument.defaultView.__REACT_DEVTOOLS_GLOBAL_HOOK__;

This comment has been minimized.

Copy link
@gaearon

This comment has been minimized.

Copy link
@bvaughn

bvaughn Jan 14, 2020

Author Contributor

<not the droids you're looking for meme>

@gaearon

This comment has been minimized.

Copy link
Member

gaearon commented Jan 14, 2020

These files are versioned together, right? They won't get out of sync on RN?

@sizebot

This comment has been minimized.

Copy link

sizebot commented Jan 14, 2020

No significant bundle size changes to report.

Size changes (experimental)

Generated by 🚫 dangerJS against 70fecdf

@bvaughn

This comment has been minimized.

Copy link
Contributor Author

bvaughn commented Jan 14, 2020

This highlighter is DOM-specific. React Native highlighting is powered by the RN Inspector.

@sizebot

This comment has been minimized.

Copy link

sizebot commented Jan 14, 2020

No significant bundle size changes to report.

Size changes (stable)

Generated by 🚫 dangerJS against 70fecdf

@bvaughn bvaughn merged commit 8aefb19 into facebook:master Jan 14, 2020
22 checks passed
22 checks passed
ci/circleci: build Your tests passed on CircleCI!
Details
ci/circleci: build_devtools_and_process_artifacts Your tests passed on CircleCI!
Details
ci/circleci: build_experimental Your tests passed on CircleCI!
Details
ci/circleci: flow Your tests passed on CircleCI!
Details
ci/circleci: lint Your tests passed on CircleCI!
Details
ci/circleci: lint_build 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 Your tests passed on CircleCI!
Details
ci/circleci: sizebot_experimental Your tests passed on CircleCI!
Details
ci/circleci: test_build Your tests passed on CircleCI!
Details
ci/circleci: test_build_experimental Your tests passed on CircleCI!
Details
ci/circleci: test_build_prod Your tests passed on CircleCI!
Details
ci/circleci: test_build_prod_experimental Your tests passed on CircleCI!
Details
ci/circleci: test_devtools Your tests passed on CircleCI!
Details
ci/circleci: test_dom_fixtures Your tests passed on CircleCI!
Details
ci/circleci: test_source Your tests passed on CircleCI!
Details
ci/circleci: test_source_experimental Your tests passed on CircleCI!
Details
ci/circleci: test_source_persistent Your tests passed on CircleCI!
Details
ci/circleci: test_source_prod Your tests passed on CircleCI!
Details
ci/codesandbox Building packages succeeded.
Details
@bvaughn bvaughn deleted the bvaughn:devtools-remove-reactInternal-reference branch Jan 14, 2020
// eslint-disable-next-line no-for-of-loops/no-for-of-loops
for (const rendererInterface of hook.rendererInterfaces.values()) {
const id = rendererInterface.getFiberIDForNative(node, true);
if (id !== null) {

This comment has been minimized.

Copy link
@konekoya

konekoya Jan 16, 2020

Contributor

@bvaughn Just curious why this is a !== null check instead of !=null? Are they used differently in the React codebase?

This comment has been minimized.

Copy link
@bvaughn

bvaughn Jan 16, 2020

Author Contributor

getFiberIDForNative always returns either an id (number) or null.

This comment has been minimized.

Copy link
@konekoya

konekoya Jan 17, 2020

Contributor

Thanks for the reply @bvaughn! And so x != null is for checking both undefined and null, right?

This comment has been minimized.

Copy link
@bvaughn

bvaughn Jan 17, 2020

Author Contributor

That's correct.

== or != handle both null and undefined

=== or !== handle either null or undefined (and are slightly more efficient)

This comment has been minimized.

Copy link
@konekoya

konekoya Jan 17, 2020

Contributor

Thank you so much for this @bvaughn! 😀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
5 participants
You can’t perform that action at this time.