@@ -67,24 +67,23 @@ window.__REACT_DEVTOOLS_GLOBAL_HOOK__.nativeWeakMap = WeakMap;
6767window.__REACT_DEVTOOLS_GLOBAL_HOOK__.nativeSet = Set;
6868` ;
6969
70- // If we have just reloaded to profile, we need to inject the renderer interface before the app loads.
71- if ( sessionStorageGetItem ( SESSION_STORAGE_RELOAD_AND_PROFILE_KEY ) === 'true' ) {
72- const rendererURL = chrome . runtime . getURL ( 'build/renderer.js' ) ;
73- let rendererCode ;
70+ // We need to inject the renderer interface before the app loads so we can patch the
71+ // console before initial render.
72+ const rendererURL = chrome . runtime . getURL ( 'build/renderer.js' ) ;
73+ let rendererCode ;
7474
75- // We need to inject in time to catch the initial mount.
76- // This means we need to synchronously read the renderer code itself,
77- // and synchronously inject it into the page.
78- // There are very few ways to actually do this.
79- // This seems to be the best approach.
80- const request = new XMLHttpRequest ( ) ;
81- request . addEventListener ( 'load' , function ( ) {
82- rendererCode = this . responseText ;
83- } ) ;
84- request . open ( 'GET' , rendererURL , false ) ;
85- request . send ( ) ;
86- injectCode ( rendererCode ) ;
87- }
75+ // We need to inject in time to catch the initial mount.
76+ // This means we need to synchronously read the renderer code itself,
77+ // and synchronously inject it into the page.
78+ // There are very few ways to actually do this.
79+ // This seems to be the best approach.
80+ const request = new XMLHttpRequest ( ) ;
81+ request . addEventListener ( 'load' , function ( ) {
82+ rendererCode = this . responseText ;
83+ } ) ;
84+ request . open ( 'GET' , rendererURL , false ) ;
85+ request . send ( ) ;
86+ injectCode ( rendererCode ) ;
8887
8988// Inject a __REACT_DEVTOOLS_GLOBAL_HOOK__ global for React to interact with.
9089// Only do this for HTML documents though, to avoid e.g. breaking syntax highlighting for XML docs.
0 commit comments