GeezerVison is showing github.com — Patch console to append component stacks (#348) · react/react@cb3fb42
File treeExpand file treeCollapse file tree Open diff view settings packages/react-devtools-core/src
Expand file treeCollapse file tree Open diff view settings Collapse file Copy file name to clipboardExpand all lines: flow-typed/npm/react-test-renderer_v16.x.x.js +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -66,7 +66,7 @@ declare module 'react-test-renderer' { | 66 | 66 | options?: TestRendererOptions | 67 | 67 | ): ReactTestRenderer; | 68 | 68 |
| 69 | | - declare function act(callback: () => void): Thenable; | | 69 | + declare function act(callback: () => ?Thenable): Thenable; | 70 | 70 | } | 71 | 71 |
| 72 | 72 | declare module 'react-test-renderer/shallow' { | |
Collapse file Copy file name to clipboardExpand all lines: package.json +5-5Lines changed: 5 additions & 5 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 138 | 138 | "opener": "^1.5.1", | 139 | 139 | "prettier": "^1.16.4", | 140 | 140 | "prop-types": "^15.6.2", | 141 | | - "react": "^0.0.0-50b50c26f", | | 141 | + "react": "^0.0.0-424099da6", | 142 | 142 | "react-15": "npm:react@^15", | 143 | 143 | "react-color": "^2.11.7", | 144 | | - "react-dom": "^0.0.0-50b50c26f", | | 144 | + "react-dom": "^0.0.0-424099da6", | 145 | 145 | "react-dom-15": "npm:react-dom@^15", | 146 | | - "react-is": "^0.0.0-50b50c26f", | 147 | | - "react-test-renderer": "^0.0.0-50b50c26f", | | 146 | + "react-is": "0.0.0-424099da6", | | 147 | + "react-test-renderer": "^0.0.0-424099da6", | 148 | 148 | "react-virtualized-auto-sizer": "^1.0.2", | 149 | 149 | "react-window": "./vendor/react-window", | 150 | 150 | "request-promise": "^4.2.4", | 151 | 151 | "rimraf": "^2.6.3", | 152 | | - "scheduler": "^0.0.0-50b50c26f", | | 152 | + "scheduler": "^0.0.0-424099da6", | 153 | 153 | "semver": "^5.5.1", | 154 | 154 | "serve-static": "^1.14.1", | 155 | 155 | "style-loader": "^0.23.1", | |
Collapse file Copy file name to clipboardExpand all lines: packages/react-devtools-core/src/standalone.js +9-5Lines changed: 9 additions & 5 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 9 | 9 | } from 'react-dom'; | 10 | 10 | import Bridge from 'src/bridge'; | 11 | 11 | import Store from 'src/devtools/store'; | 12 | | -import { getSavedComponentFilters } from 'src/utils'; | | 12 | +import { getSavedComponentFilters, getAppendComponentStack } from 'src/utils'; | 13 | 13 | import { Server } from 'ws'; | 14 | 14 | import { existsSync, readFileSync } from 'fs'; | 15 | 15 | import { installHook } from 'src/hook'; | @@ -241,12 +241,16 @@ function startServer(port?: number = 8097) { | 241 | 241 | // because they are generally stored in localStorage within the context of the extension. | 242 | 242 | // Because of this it relies on the extension to pass filters, so include them wth the response here. | 243 | 243 | // This will ensure that saved filters are shared across different web pages. | 244 | | - const savedFiltersString = `window.__REACT_DEVTOOLS_COMPONENT_FILTERS__ = ${JSON.stringify( | 245 | | - getSavedComponentFilters() | 246 | | - )};`; | | 244 | + const savedPreferencesString = ` | | 245 | + window.__REACT_DEVTOOLS_COMPONENT_FILTERS__ = ${JSON.stringify( | | 246 | + getSavedComponentFilters() | | 247 | + )}; | | 248 | + window.__REACT_DEVTOOLS_APPEND_COMPONENT_STACK__ = ${JSON.stringify( | | 249 | + getAppendComponentStack() | | 250 | + )};`; | 247 | 251 |
| 248 | 252 | response.end( | 249 | | - savedFiltersString + | | 253 | + savedPreferencesString + | 250 | 254 | '\n;' + | 251 | 255 | backendFile.toString() + | 252 | 256 | '\n;' + | |
Collapse file Copy file name to clipboardExpand all lines: shells/browser/shared/src/main.js +12-5Lines changed: 12 additions & 5 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -6,7 +6,7 @@ import Bridge from 'src/bridge'; | 6 | 6 | import Store from 'src/devtools/store'; | 7 | 7 | import inject from './inject'; | 8 | 8 | import { createViewElementSource, getBrowserTheme } from './utils'; | 9 | | -import { getSavedComponentFilters } from 'src/utils'; | | 9 | +import { getSavedComponentFilters, getAppendComponentStack } from 'src/utils'; | 10 | 10 | import { | 11 | 11 | localStorageGetItem, | 12 | 12 | localStorageRemoveItem, | @@ -22,16 +22,23 @@ let panelCreated = false; | 22 | 22 | // The renderer interface can't read saved component filters directly, | 23 | 23 | // because they are stored in localStorage within the context of the extension. | 24 | 24 | // Instead it relies on the extension to pass filters through. | 25 | | -function initializeSavedComponentFilters() { | | 25 | +function syncSavedPreferences() { | 26 | 26 | const componentFilters = getSavedComponentFilters(); | 27 | 27 | chrome.devtools.inspectedWindow.eval( | 28 | 28 | `window.__REACT_DEVTOOLS_COMPONENT_FILTERS__ = ${JSON.stringify( | 29 | 29 | componentFilters | 30 | 30 | )};` | 31 | 31 | ); | | 32 | + | | 33 | + const appendComponentStack = getAppendComponentStack(); | | 34 | + chrome.devtools.inspectedWindow.eval( | | 35 | + `window.__REACT_DEVTOOLS_APPEND_COMPONENT_STACK__ = ${JSON.stringify( | | 36 | + appendComponentStack | | 37 | + )};` | | 38 | + ); | 32 | 39 | } | 33 | 40 |
| 34 | | -initializeSavedComponentFilters(); | | 41 | +syncSavedPreferences(); | 35 | 42 |
| 36 | 43 | function createPanelIfReactLoaded() { | 37 | 44 | if (panelCreated) { | @@ -286,7 +293,7 @@ function createPanelIfReactLoaded() { | 286 | 293 | chrome.devtools.network.onNavigated.addListener(function onNavigated() { | 287 | 294 | // Re-initialize saved filters on navigation, | 288 | 295 | // since global values stored on window get reset in this case. | 289 | | - initializeSavedComponentFilters(); | | 296 | + syncSavedPreferences(); | 290 | 297 |
| 291 | 298 | // It's easiest to recreate the DevTools panel (to clean up potential stale state). | 292 | 299 | // We can revisit this in the future as a small optimization. | @@ -302,7 +309,7 @@ function createPanelIfReactLoaded() { | 302 | 309 |
| 303 | 310 | // Load (or reload) the DevTools extension when the user navigates to a new page. | 304 | 311 | function checkPageForReact() { | 305 | | - initializeSavedComponentFilters(); | | 312 | + syncSavedPreferences(); | 306 | 313 | createPanelIfReactLoaded(); | 307 | 314 | } | 308 | 315 |
| |
Collapse file Copy file name to clipboardExpand all lines: shells/dev/src/devtools.js +2-1Lines changed: 2 additions & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -8,7 +8,7 @@ import { installHook } from 'src/hook'; | 8 | 8 | import { initDevTools } from 'src/devtools'; | 9 | 9 | import Store from 'src/devtools/store'; | 10 | 10 | import DevTools from 'src/devtools/views/DevTools'; | 11 | | -import { getSavedComponentFilters } from 'src/utils'; | | 11 | +import { getSavedComponentFilters, getAppendComponentStack } from 'src/utils'; | 12 | 12 |
| 13 | 13 | const iframe = ((document.getElementById('target'): any): HTMLIFrameElement); | 14 | 14 |
| @@ -18,6 +18,7 @@ const { contentDocument, contentWindow } = iframe; | 18 | 18 | // because they are stored in localStorage within the context of the extension. | 19 | 19 | // Instead it relies on the extension to pass filters through. | 20 | 20 | contentWindow.__REACT_DEVTOOLS_COMPONENT_FILTERS__ = getSavedComponentFilters(); | | 21 | +contentWindow.__REACT_DEVTOOLS_APPEND_COMPONENT_STACK__ = getAppendComponentStack(); | 21 | 22 |
| 22 | 23 | installHook(contentWindow); | 23 | 24 |
| |
|