Skip to content

Commit

Permalink
Delete early patching registerRendererWithConsole
Browse files Browse the repository at this point in the history
This doesn't inject onErrorAndWarning and getComponentStack so it doesn't
really do anything useful anyway.
  • Loading branch information
sebmarkbage committed Sep 9, 2024
1 parent 1c3825f commit 0224613
Showing 1 changed file with 0 additions and 19 deletions.
19 changes: 0 additions & 19 deletions packages/react-devtools-shared/src/hook.js
Original file line number Diff line number Diff line change
Expand Up @@ -367,25 +367,6 @@ export function installHook(target: any): DevToolsHook | null {
? 'deadcode'
: detectReactBuildType(renderer);

// Patching the console enables DevTools to do a few useful things:
// * Append component stacks to warnings and error messages
// * Disabling or marking logs during a double render in Strict Mode
// * Disable logging during re-renders to inspect hooks (see inspectHooksOfFiber)
//
// Allow patching console early (during injection) to
// provide developers with components stacks even if they don't run DevTools.
if (target.hasOwnProperty('__REACT_DEVTOOLS_CONSOLE_FUNCTIONS__')) {
const {registerRendererWithConsole, patchConsoleUsingWindowValues} =
target.__REACT_DEVTOOLS_CONSOLE_FUNCTIONS__;
if (
typeof registerRendererWithConsole === 'function' &&
typeof patchConsoleUsingWindowValues === 'function'
) {
registerRendererWithConsole(renderer);
patchConsoleUsingWindowValues();
}
}

// If we have just reloaded to profile, we need to inject the renderer interface before the app loads.
// Otherwise the renderer won't yet exist and we can skip this step.
const attach = target.__REACT_DEVTOOLS_ATTACH__;
Expand Down

0 comments on commit 0224613

Please sign in to comment.