@@ -19,7 +19,6 @@ type DevToolsProfilingHooks = any;
1919
2020import { DidCapture } from './ReactFiberFlags' ;
2121import {
22- consoleManagedByDevToolsDuringStrictMode ,
2322 enableProfilerTimer ,
2423 enableSchedulingProfiler ,
2524} from 'shared/ReactFeatureFlags' ;
@@ -38,7 +37,6 @@ import {
3837 unstable_setDisableYieldValue ,
3938} from './Scheduler' ;
4039import { setSuppressWarning } from 'shared/consoleWithStackDev' ;
41- import { disableLogs , reenableLogs } from 'shared/ConsolePatchingDev' ;
4240
4341declare const __REACT_DEVTOOLS_GLOBAL_HOOK__: Object | void ;
4442
@@ -188,36 +186,25 @@ export function onCommitUnmount(fiber: Fiber) {
188186}
189187
190188export function setIsStrictModeForDevtools ( newIsStrictMode : boolean ) {
191- if ( consoleManagedByDevToolsDuringStrictMode ) {
192- if ( typeof log === 'function' ) {
193- // We're in a test because Scheduler.log only exists
194- // in SchedulerMock. To reduce the noise in strict mode tests,
195- // suppress warnings and disable scheduler yielding during the double render
196- unstable_setDisableYieldValue ( newIsStrictMode ) ;
197- setSuppressWarning ( newIsStrictMode ) ;
198- }
189+ if ( typeof log === 'function' ) {
190+ // We're in a test because Scheduler.log only exists
191+ // in SchedulerMock. To reduce the noise in strict mode tests,
192+ // suppress warnings and disable scheduler yielding during the double render
193+ unstable_setDisableYieldValue ( newIsStrictMode ) ;
194+ setSuppressWarning ( newIsStrictMode ) ;
195+ }
199196
200- if ( injectedHook && typeof injectedHook . setStrictMode === 'function' ) {
201- try {
202- injectedHook . setStrictMode ( rendererID , newIsStrictMode ) ;
203- } catch ( err ) {
204- if ( __DEV__ ) {
205- if ( ! hasLoggedError ) {
206- hasLoggedError = true ;
207- console . error (
208- 'React instrumentation encountered an error: %s' ,
209- err ,
210- ) ;
211- }
197+ if ( injectedHook && typeof injectedHook . setStrictMode === 'function' ) {
198+ try {
199+ injectedHook . setStrictMode ( rendererID , newIsStrictMode ) ;
200+ } catch ( err ) {
201+ if ( __DEV__ ) {
202+ if ( ! hasLoggedError ) {
203+ hasLoggedError = true ;
204+ console . error ( 'React instrumentation encountered an error: %s' , err ) ;
212205 }
213206 }
214207 }
215- } else {
216- if ( newIsStrictMode ) {
217- disableLogs ( ) ;
218- } else {
219- reenableLogs ( ) ;
220- }
221208 }
222209}
223210
0 commit comments