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-dom] Provide a way to silence devtools recommendation #28919

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

rtpg
Copy link

@rtpg rtpg commented Apr 26, 2024

If you hit this console message and search for how to turn it off, many people recommend hacky ways to do so that also end up breaking the extension if you actually want to use it later on.

This provides a way to turn off just the message, without trying to trick injectIntoDevTools into thinking something's happened.

This SO answer is a good example of a "wrong answer" to disabling this logging warning:

window.__REACT_DEVTOOLS_GLOBAL_HOOK__ = { isDisabled: true };

This disables the integration entirely instead of simply removing the warning if it's not installed. A project might want to simply not have the log show up for its own reasons.

I'm sending this up, if it's OK in principle the best thing would be to include 2 lines in some docs so that it can be the first result of a web search for people looking to disable it.

As to why I want to disable this: I run some tests without minified react. In the CI environment I do not need the devtools installed. I would like to avoid having to write some special-cased code to hack-away a removal of this message.

related issues: #12041

@facebook-github-bot
Copy link

Hi @rtpg!

Thank you for your pull request and welcome to our community.

Action Required

In order to merge any pull request (code, docs, etc.), we require contributors to sign our Contributor License Agreement, and we don't seem to have one on file for you.

Process

In order for us to review and merge your suggested changes, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA.

Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with CLA signed. The tagging process may take up to 1 hour after signing. Please give it that time before contacting us about it.

If you have received this in error or have any questions, please contact us at cla@meta.com. Thanks!

@react-sizebot
Copy link

react-sizebot commented Apr 26, 2024

Comparing: c408361...6797b36

Critical size changes

Includes critical production bundles, as well as any change greater than 2%:

Name +/- Base Current +/- gzip Base gzip Current gzip
oss-stable/react-dom/cjs/react-dom.production.js = 6.66 kB 6.66 kB +0.11% 1.82 kB 1.82 kB
oss-experimental/react-dom/cjs/react-dom.production.js = 6.67 kB 6.67 kB +0.11% 1.83 kB 1.83 kB
facebook-www/ReactDOM-prod.classic.js = 591.11 kB 591.11 kB = 103.94 kB 103.94 kB
facebook-www/ReactDOM-prod.modern.js = 567.33 kB 567.33 kB = 100.34 kB 100.34 kB
test_utils/ReactAllWarnings.js Deleted 64.26 kB 0.00 kB Deleted 16.02 kB 0.00 kB

Significant size changes

Includes any change greater than 0.2%:

Expand to show
Name +/- Base Current +/- gzip Base gzip Current gzip
test_utils/ReactAllWarnings.js Deleted 64.26 kB 0.00 kB Deleted 16.02 kB 0.00 kB

Generated by 🚫 dangerJS against 6797b36

@facebook-github-bot
Copy link

Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Meta Open Source project. Thanks!

If you hit this console message and search for how to turn it off, many people recommend hacky ways to do so that also end up breaking the extension if you actually want to use it later on.

This provides a way to turn off just the message, without trying to trick injectIntoDevTools into thinking something's happened.
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.

None yet

3 participants