Skip to content

Commit 0597605

Browse files
authored
Flag to remove www console forks (facebook#32058)
Let's remove these
1 parent 886c5ad commit 0597605

10 files changed

+28
-2
lines changed

packages/shared/ReactFeatureFlags.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -261,3 +261,5 @@ export const enableUpdaterTracking = __PROFILE__;
261261

262262
// Internal only.
263263
export const enableDO_NOT_USE_disableStrictPassiveEffect = false;
264+
265+
export const enableRemoveConsolePatches = true;

packages/shared/forks/ReactFeatureFlags.native-fb-dynamic.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,3 +27,4 @@ export const enableFabricCompleteRootInCommitPhase = __VARIANT__;
2727
export const enableSiblingPrerendering = __VARIANT__;
2828
export const enableUseResourceEffectHook = __VARIANT__;
2929
export const enableOwnerStacks = __VARIANT__;
30+
export const enableRemoveConsolePatches = __VARIANT__;

packages/shared/forks/ReactFeatureFlags.native-fb.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ export const {
2929
passChildrenWhenCloningPersistedNodes,
3030
enableSiblingPrerendering,
3131
enableOwnerStacks,
32+
enableRemoveConsolePatches,
3233
} = dynamicFlags;
3334

3435
// The rest of the flags are static for better dead code elimination.

packages/shared/forks/ReactFeatureFlags.native-oss.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ export const enableProfilerTimer = __PROFILE__;
7878
export const enableProfilerCommitHooks = __PROFILE__;
7979
export const enableProfilerNestedUpdatePhase = __PROFILE__;
8080
export const enableUpdaterTracking = __PROFILE__;
81+
export const enableRemoveConsolePatches = false;
8182

8283
// Flow magic to verify the exports of this file match the original version.
8384
((((null: any): ExportsType): FeatureFlagsType): ExportsType);

packages/shared/forks/ReactFeatureFlags.test-renderer.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@ export const disableDefaultPropsExceptForClasses = true;
8888

8989
export const enableObjectFiber = false;
9090
export const enableOwnerStacks = false;
91+
export const enableRemoveConsolePatches = true;
9192

9293
// Flow magic to verify the exports of this file match the original version.
9394
((((null: any): ExportsType): FeatureFlagsType): ExportsType);

packages/shared/forks/ReactFeatureFlags.test-renderer.native-fb.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ export const enableHydrationLaneScheduling = true;
6868
export const enableYieldingBeforePassive = false;
6969
export const enableThrottledScheduling = false;
7070
export const enableViewTransition = false;
71+
export const enableRemoveConsolePatches = false;
7172

7273
// Flow magic to verify the exports of this file match the original version.
7374
((((null: any): ExportsType): FeatureFlagsType): ExportsType);

packages/shared/forks/ReactFeatureFlags.test-renderer.www.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ export const enableYieldingBeforePassive = false;
8383

8484
export const enableThrottledScheduling = false;
8585
export const enableViewTransition = false;
86+
export const enableRemoveConsolePatches = false;
8687

8788
// Flow magic to verify the exports of this file match the original version.
8889
((((null: any): ExportsType): FeatureFlagsType): ExportsType);

packages/shared/forks/ReactFeatureFlags.www-dynamic.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ export const enableInfiniteRenderLoopDetection = __VARIANT__;
3737
export const enableSiblingPrerendering = __VARIANT__;
3838

3939
export const enableUseResourceEffectHook = __VARIANT__;
40+
export const enableRemoveConsolePatches = __VARIANT__;
4041

4142
// TODO: These flags are hard-coded to the default values used in open source.
4243
// Update the tests so that they pass in either mode, then set these

packages/shared/forks/ReactFeatureFlags.www.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ export const {
3636
syncLaneExpirationMs,
3737
transitionLaneExpirationMs,
3838
enableOwnerStacks,
39+
enableRemoveConsolePatches,
3940
} = dynamicFeatureFlags;
4041

4142
// On WWW, __EXPERIMENTAL__ is used for a new modern build.

packages/shared/forks/consoleWithStackDev.www.js

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,33 +5,49 @@
55
* LICENSE file in the root directory of this source tree.
66
*/
77

8+
const {enableRemoveConsolePatches} = require('shared/ReactFeatureFlags');
9+
810
// This refers to a WWW module.
911
const warningWWW = require('warning');
1012

1113
let suppressWarning = false;
1214
export function setSuppressWarning(newSuppressWarning) {
15+
if (enableRemoveConsolePatches) {
16+
return;
17+
}
1318
if (__DEV__) {
1419
suppressWarning = newSuppressWarning;
1520
}
1621
}
1722

1823
export function warn(format, ...args) {
19-
if (__DEV__) {
24+
if (enableRemoveConsolePatches) {
25+
if (__DEV__) {
26+
console['warn'](format, ...args);
27+
}
28+
} else if (__DEV__) {
2029
if (!suppressWarning) {
2130
printWarning('warn', format, args);
2231
}
2332
}
2433
}
2534

2635
export function error(format, ...args) {
27-
if (__DEV__) {
36+
if (enableRemoveConsolePatches) {
37+
if (__DEV__) {
38+
console['error'](format, ...args);
39+
}
40+
} else if (__DEV__) {
2841
if (!suppressWarning) {
2942
printWarning('error', format, args);
3043
}
3144
}
3245
}
3346

3447
function printWarning(level, format, args) {
48+
if (enableRemoveConsolePatches) {
49+
return;
50+
}
3551
if (__DEV__) {
3652
const React = require('react');
3753
const ReactSharedInternals =

0 commit comments

Comments
 (0)