File tree Expand file tree Collapse file tree 3 files changed +8
-4
lines changed
react-devtools-shared/src/devtools/views/Settings Expand file tree Collapse file tree 3 files changed +8
-4
lines changed Original file line number Diff line number Diff line change @@ -46,7 +46,7 @@ export default function DebuggingSettings(_: {||}) {
4646 setEnableDoubleLogging ( currentTarget . checked )
4747 }
4848 /> { ' ' }
49- Enable double logging
49+ Suppress console during development-only second render pass
5050 </ label >
5151 </ div >
5252 < div className = { styles . Setting } >
Original file line number Diff line number Diff line change @@ -89,7 +89,7 @@ function SettingsContextController({
8989 setEnableDoubleLogging ,
9090 ] = useLocalStorage < boolean > (
9191 LOCAL_STORAGE_SHOULD_ENABLE_DOUBLE_LOGGING ,
92- false ,
92+ true ,
9393 ) ;
9494
9595 const [
Original file line number Diff line number Diff line change 1111// replaying on render function. This currently only patches the object
1212// lazily which won't cover if the log function was extracted eagerly.
1313// We could also eagerly patch the method.
14+ import { canUseDOM } from './ExecutionEnvironment' ;
1415
1516let disabledDepth = 0 ;
1617let prevLog ;
@@ -20,13 +21,16 @@ let prevError;
2021let prevGroup ;
2122let prevGroupCollapsed ;
2223let prevGroupEnd ;
24+ const {
25+ __REACT_DEVTOOLS_ENABLE_DOUBLE_LOGGING__ : enableDoubleLogging ,
26+ } = canUseDOM ? window : global ;
2327
2428function disabledLog ( ) { }
2529disabledLog . __reactDisabledLog = true ;
2630
2731export function disableLogs ( ) : void {
2832 if ( __DEV__ ) {
29- if ( disabledDepth === 0 ) {
33+ if ( disabledDepth === 0 && ! enableDoubleLogging ) {
3034 /* eslint-disable react-internal/no-production-logging */
3135 prevLog = console . log ;
3236 prevInfo = console . info ;
@@ -61,7 +65,7 @@ export function disableLogs(): void {
6165export function reenableLogs ( ) : void {
6266 if ( __DEV__ ) {
6367 disabledDepth -- ;
64- if ( disabledDepth === 0 ) {
68+ if ( disabledDepth === 0 && ! enableDoubleLogging ) {
6569 /* eslint-disable react-internal/no-production-logging */
6670 const props = {
6771 configurable : true ,
You can’t perform that action at this time.
0 commit comments