File tree 3 files changed +8
-4
lines changed
react-devtools-shared/src/devtools/views/Settings
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(_: {||}) {
46
46
setEnableDoubleLogging ( currentTarget . checked )
47
47
}
48
48
/> { ' ' }
49
- Enable double logging
49
+ Suppress console during development-only second render pass
50
50
</ label >
51
51
</ div >
52
52
< div className = { styles . Setting } >
Original file line number Diff line number Diff line change @@ -89,7 +89,7 @@ function SettingsContextController({
89
89
setEnableDoubleLogging ,
90
90
] = useLocalStorage < boolean > (
91
91
LOCAL_STORAGE_SHOULD_ENABLE_DOUBLE_LOGGING ,
92
- false ,
92
+ true ,
93
93
) ;
94
94
95
95
const [
Original file line number Diff line number Diff line change 11
11
// replaying on render function. This currently only patches the object
12
12
// lazily which won't cover if the log function was extracted eagerly.
13
13
// We could also eagerly patch the method.
14
+ import { canUseDOM } from './ExecutionEnvironment' ;
14
15
15
16
let disabledDepth = 0 ;
16
17
let prevLog ;
@@ -20,13 +21,16 @@ let prevError;
20
21
let prevGroup ;
21
22
let prevGroupCollapsed ;
22
23
let prevGroupEnd ;
24
+ const {
25
+ __REACT_DEVTOOLS_ENABLE_DOUBLE_LOGGING__ : enableDoubleLogging ,
26
+ } = canUseDOM ? window : global ;
23
27
24
28
function disabledLog ( ) { }
25
29
disabledLog . __reactDisabledLog = true ;
26
30
27
31
export function disableLogs ( ) : void {
28
32
if ( __DEV__ ) {
29
- if ( disabledDepth === 0 ) {
33
+ if ( disabledDepth === 0 && ! enableDoubleLogging ) {
30
34
/* eslint-disable react-internal/no-production-logging */
31
35
prevLog = console . log ;
32
36
prevInfo = console . info ;
@@ -61,7 +65,7 @@ export function disableLogs(): void {
61
65
export function reenableLogs ( ) : void {
62
66
if ( __DEV__ ) {
63
67
disabledDepth -- ;
64
- if ( disabledDepth === 0 ) {
68
+ if ( disabledDepth === 0 && ! enableDoubleLogging ) {
65
69
/* eslint-disable react-internal/no-production-logging */
66
70
const props = {
67
71
configurable : true ,
You can’t perform that action at this time.
0 commit comments