mirror of
https://github.com/facebook/react.git
synced 2026-11-18 20:15:56 +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:
1 parent
0f2fb5badf
commit
cb3fb42129
24 files changed
+1085
-257
No files matched your search
@@ -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