@samitouri / QOS-React-1 / commits / 85acf2d195

Delete suppressWarning in OSS (#30312)

I'm pretty sure this is completely unnecessary even in www and RN because it's only useful if you use the mock scheduler which typically only we do in our own tests. But all our tests pass so unless www/RN does something with it, I don't think this is used. Also remove unnecessary `__DEV__` check. If it gets pulled in prod, we'd want to know about it.

Sebastian Markbåge committed Jul 11, 2024 at 11:20 UTC 85acf2d19527df568136ba08be97aa766d427ff2
1 file changed +3 -14
packages/shared/consoleWithStackDev.js
+3 -14
@@ -8,11 +8,8 @@
8 import ReactSharedInternals from 'shared/ReactSharedInternals';
9 import {enableOwnerStacks} from 'shared/ReactFeatureFlags';
10
11 -let suppressWarning = false;
11 export function setSuppressWarning(newSuppressWarning) {
13 - if (__DEV__) {
14 - suppressWarning = newSuppressWarning;
15 - }
12 + // TODO: Noop. Delete.
13 }
14
15 // In DEV, calls to console.warn and console.error get replaced
@@ -22,19 +19,11 @@ export function setSuppressWarning(newSuppressWarning) {
19 // they are left as they are instead.
20
21 export function warn(format, ...args) {
25 - if (__DEV__) {
26 - if (!suppressWarning) {
27 - printWarning('warn', format, args, new Error('react-stack-top-frame'));
28 - }
29 - }
22 + printWarning('warn', format, args, new Error('react-stack-top-frame'));
23 }
24
25 export function error(format, ...args) {
33 - if (__DEV__) {
34 - if (!suppressWarning) {
35 - printWarning('error', format, args, new Error('react-stack-top-frame'));
36 - }
37 - }
26 + printWarning('error', format, args, new Error('react-stack-top-frame'));
27 }
28
29 // eslint-disable-next-line react-internal/no-production-logging