GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Add consoleManagedByDevToolsDuringStrictMode feature flag in React Re… · react/react@fc40f02

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • packages
    • react-reconciler/src
      • ReactFiberReconciler.new.js
      • ReactFiberReconciler.old.js
    • react/src/__tests__
      • ReactStrictMode-test.js
    • shared
      • ReactFeatureFlags.js
      • forks
        • ReactFeatureFlags.native-fb.js
        • ReactFeatureFlags.native-oss.js
        • ReactFeatureFlags.test-renderer.js
        • ReactFeatureFlags.test-renderer.native.js
        • ReactFeatureFlags.test-renderer.www.js
        • ReactFeatureFlags.testing.js
        • ReactFeatureFlags.testing.www.js
        • ReactFeatureFlags.www-dynamic.js
        • ReactFeatureFlags.www.js
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎packages/react-reconciler/src/ReactFiberReconciler.new.js‎

Copy file name to clipboardExpand all lines: packages/react-reconciler/src/ReactFiberReconciler.new.js
+21-8Lines changed: 21 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,10 @@ import {
3535
import getComponentNameFromFiber from 'react-reconciler/src/getComponentNameFromFiber';
3636
import invariant from 'shared/invariant';
3737
import isArray from 'shared/isArray';
38-
import {enableSchedulingProfiler} from 'shared/ReactFeatureFlags';
38+
import {
39+
enableSchedulingProfiler,
40+
consoleManagedByDevToolsDuringStrictMode,
41+
} from 'shared/ReactFeatureFlags';
3942
import ReactSharedInternals from 'shared/ReactSharedInternals';
4043
import {getPublicInstance} from './ReactFiberHostConfig';
4144
import {
@@ -107,6 +110,7 @@ export {
107110

108111
import * as Scheduler from './Scheduler';
109112
import {setSuppressWarning} from 'shared/consoleWithStackDev';
113+
import {disableLogs, reenableLogs} from 'shared/ConsolePatchingDev';
110114

111115
type OpaqueRoot = FiberRoot;
112116

@@ -717,14 +721,23 @@ export function getIsStrictModeForDevtools() {
717721
}
718722

719723
export function setIsStrictModeForDevtools(newIsStrictMode: boolean) {
720-
// We're in a test because Scheduler.unstable_yieldValue only exists
721-
// in SchedulerMock. To reduce the noise in strict mode tests,
722-
// suppress warnings and disable scheduler yielding during the double render
723-
if (typeof Scheduler.unstable_yieldValue === 'function') {
724-
Scheduler.unstable_setDisableYieldValue(newIsStrictMode);
725-
setSuppressWarning(newIsStrictMode);
726-
}
727724
isStrictMode = newIsStrictMode;
725+
726+
if (consoleManagedByDevToolsDuringStrictMode) {
727+
// We're in a test because Scheduler.unstable_yieldValue only exists
728+
// in SchedulerMock. To reduce the noise in strict mode tests,
729+
// suppress warnings and disable scheduler yielding during the double render
730+
if (typeof Scheduler.unstable_yieldValue === 'function') {
731+
Scheduler.unstable_setDisableYieldValue(newIsStrictMode);
732+
setSuppressWarning(newIsStrictMode);
733+
}
734+
} else {
735+
if (newIsStrictMode) {
736+
disableLogs();
737+
} else {
738+
reenableLogs();
739+
}
740+
}
728741
}
729742

730743
export function injectIntoDevTools(devToolsConfig: DevToolsConfig): boolean {
Collapse file

‎packages/react-reconciler/src/ReactFiberReconciler.old.js‎

Copy file name to clipboardExpand all lines: packages/react-reconciler/src/ReactFiberReconciler.old.js
+21-8Lines changed: 21 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,10 @@ import {
3535
import getComponentNameFromFiber from 'react-reconciler/src/getComponentNameFromFiber';
3636
import invariant from 'shared/invariant';
3737
import isArray from 'shared/isArray';
38-
import {enableSchedulingProfiler} from 'shared/ReactFeatureFlags';
38+
import {
39+
enableSchedulingProfiler,
40+
consoleManagedByDevToolsDuringStrictMode,
41+
} from 'shared/ReactFeatureFlags';
3942
import ReactSharedInternals from 'shared/ReactSharedInternals';
4043
import {getPublicInstance} from './ReactFiberHostConfig';
4144
import {
@@ -107,6 +110,7 @@ export {
107110

108111
import * as Scheduler from './Scheduler';
109112
import {setSuppressWarning} from 'shared/consoleWithStackDev';
113+
import {disableLogs, reenableLogs} from 'shared/ConsolePatchingDev';
110114

111115
type OpaqueRoot = FiberRoot;
112116

@@ -717,14 +721,23 @@ export function getIsStrictModeForDevtools() {
717721
}
718722

719723
export function setIsStrictModeForDevtools(newIsStrictMode: boolean) {
720-
// We're in a test because Scheduler.unstable_yieldValue only exists
721-
// in SchedulerMock. To reduce the noise in strict mode tests,
722-
// suppress warnings and disable scheduler yielding during the double render
723-
if (typeof Scheduler.unstable_yieldValue === 'function') {
724-
Scheduler.unstable_setDisableYieldValue(newIsStrictMode);
725-
setSuppressWarning(newIsStrictMode);
726-
}
727724
isStrictMode = newIsStrictMode;
725+
726+
if (consoleManagedByDevToolsDuringStrictMode) {
727+
// We're in a test because Scheduler.unstable_yieldValue only exists
728+
// in SchedulerMock. To reduce the noise in strict mode tests,
729+
// suppress warnings and disable scheduler yielding during the double render
730+
if (typeof Scheduler.unstable_yieldValue === 'function') {
731+
Scheduler.unstable_setDisableYieldValue(newIsStrictMode);
732+
setSuppressWarning(newIsStrictMode);
733+
}
734+
} else {
735+
if (newIsStrictMode) {
736+
disableLogs();
737+
} else {
738+
reenableLogs();
739+
}
740+
}
728741
}
729742

730743
export function injectIntoDevTools(devToolsConfig: DevToolsConfig): boolean {

0 commit comments

Comments
0 (0)
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.