mirror of
https://github.com/facebook/react.git
synced 2025-11-01 09:12:30 +00:00
DevTools fork console patching logic (#21301)
React has its own component stack generation code that DevTools embeds a fork of, but both of them use a shared helper for disabling console logs. This shared helper is DEV only though, because it was intended for use with React DEV-only warnings and we didn't want to unnecessarily add bytes to production builds.
But DevTools itself always ships as a production build– even when it's used to debug DEV bundles of product apps (with third party DEV-only warnings). That means this helper was always a noop.
The resolveCurrentDispatcher method was changed recently to replace the thrown error with a call to console.error. This newly logged error ended up slipping through and being user visible because of the above issue.
This PR updates DevTools to also fork the console patching logic (to remove the DEV-only guard).
Note that I didn't spot this earlier because my test harness (react-devtools-shell) always runs in DEV mode. 🤡
This commit is contained in:
@@ -29,9 +29,9 @@ import {
|
||||
SUSPENSE_LIST_SYMBOL_STRING,
|
||||
} from './ReactSymbols';
|
||||
|
||||
// These methods are safe to import from shared;
|
||||
// there is no React-specific logic here.
|
||||
import {disableLogs, reenableLogs} from 'shared/ConsolePatchingDev';
|
||||
// The shared console patching code is DEV-only.
|
||||
// We can't use it since DevTools only ships production builds.
|
||||
import {disableLogs, reenableLogs} from './DevToolsConsolePatching';
|
||||
|
||||
let prefix;
|
||||
export function describeBuiltInComponentFrame(
|
||||
|
||||
Reference in New Issue
Block a user