mirror of
https://github.com/facebook/react.git
synced 2025-11-01 09:12:30 +00:00
Patch console to append component stacks (#348)
* Patch console.warn and console.error to auto-append owners-only component stacks. This setting is enabled by default and will work for React Native even if no front-end DevTools shell is being used. The setting can be disabled via a new, persisted user preference though.
This commit is contained in:
@@ -8,7 +8,7 @@ import { installHook } from 'src/hook';
|
||||
import { initDevTools } from 'src/devtools';
|
||||
import Store from 'src/devtools/store';
|
||||
import DevTools from 'src/devtools/views/DevTools';
|
||||
import { getSavedComponentFilters } from 'src/utils';
|
||||
import { getSavedComponentFilters, getAppendComponentStack } from 'src/utils';
|
||||
|
||||
const iframe = ((document.getElementById('target'): any): HTMLIFrameElement);
|
||||
|
||||
@@ -18,6 +18,7 @@ const { contentDocument, contentWindow } = iframe;
|
||||
// because they are stored in localStorage within the context of the extension.
|
||||
// Instead it relies on the extension to pass filters through.
|
||||
contentWindow.__REACT_DEVTOOLS_COMPONENT_FILTERS__ = getSavedComponentFilters();
|
||||
contentWindow.__REACT_DEVTOOLS_APPEND_COMPONENT_STACK__ = getAppendComponentStack();
|
||||
|
||||
installHook(contentWindow);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user