-
Notifications
You must be signed in to change notification settings - Fork 46.8k
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
Bug: disableLogs mutates console #20575
Comments
Hey @jcdang, thanks for submitting. We only disable the console in the second call, you should still see logs from the first call.
If we didn't do this, the console would contain duplicate messages so we made the tradeoff to disable it in the second pass. This can have side effects, which we offer a workaround for. |
Hey @rickhanlonii thanks for the explanation. You actually highlighted the underlying issue I am having! I'm trying to write a child reconciler right now and eventually discovered the existence of the two passes. Would you be able to direct me to the design/intent for this two-pass approach or maybe how to disable it for child-reconcilers in the tree? |
To follow up on this, we've changed the logging behavior in 18 to be more intuitive. |
It's noted on the docs pages at https://reactjs.org/docs/strict-mode.html
react-dom currently disables/mutates the global console in strict mode.
This seems to be an intentional feature/bug that's an unnecessary inconvenience.
React version: 17.0.1
Steps To Reproduce
The current behavior
logging is disabled in strict-mode
The expected behavior
Possible better solutions:
The text was updated successfully, but these errors were encountered: