Skip to content

Commit 30a81df

Browse files
committed
Remove consoleManagedByDevToolsDuringStrictMode
1 parent a7b8295 commit 30a81df

9 files changed

+201
-446
lines changed

packages/react-reconciler/src/ReactFiberDevToolsHook.js

Lines changed: 15 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ type DevToolsProfilingHooks = any;
1919

2020
import {DidCapture} from './ReactFiberFlags';
2121
import {
22-
consoleManagedByDevToolsDuringStrictMode,
2322
enableProfilerTimer,
2423
enableSchedulingProfiler,
2524
} from 'shared/ReactFeatureFlags';
@@ -188,36 +187,25 @@ export function onCommitUnmount(fiber: Fiber) {
188187
}
189188

190189
export 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-
}
190+
if (typeof log === 'function') {
191+
// We're in a test because Scheduler.log only exists
192+
// in SchedulerMock. To reduce the noise in strict mode tests,
193+
// suppress warnings and disable scheduler yielding during the double render
194+
unstable_setDisableYieldValue(newIsStrictMode);
195+
setSuppressWarning(newIsStrictMode);
196+
}
199197

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-
}
198+
if (injectedHook && typeof injectedHook.setStrictMode === 'function') {
199+
try {
200+
injectedHook.setStrictMode(rendererID, newIsStrictMode);
201+
} catch (err) {
202+
if (__DEV__) {
203+
if (!hasLoggedError) {
204+
hasLoggedError = true;
205+
console.error('React instrumentation encountered an error: %s', err);
212206
}
213207
}
214208
}
215-
} else {
216-
if (newIsStrictMode) {
217-
disableLogs();
218-
} else {
219-
reenableLogs();
220-
}
221209
}
222210
}
223211

0 commit comments

Comments
 (0)