Skip to content

Commit 09a2c36

Browse files
eps1lonBrian Vaughn
and
Brian Vaughn
authored
Expose DEV-mode warnings in devtools UI (facebook#20463)
Co-authored-by: Brian Vaughn <bvaughn@fb.com>
1 parent 6cbb939 commit 09a2c36

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+4613
-1794
lines changed

packages/react-devtools-core/src/standalone.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ import {
2020
getAppendComponentStack,
2121
getBreakOnConsoleErrors,
2222
getSavedComponentFilters,
23+
getShowInlineWarningsAndErrors,
2324
} from 'react-devtools-shared/src/utils';
2425
import {Server} from 'ws';
2526
import {join} from 'path';
@@ -303,6 +304,9 @@ function startServer(
303304
)};
304305
window.__REACT_DEVTOOLS_COMPONENT_FILTERS__ = ${JSON.stringify(
305306
getSavedComponentFilters(),
307+
)};
308+
window.__REACT_DEVTOOLS_SHOW_INLINE_WARNINGS_AND_ERRORS__ = ${JSON.stringify(
309+
getShowInlineWarningsAndErrors(),
306310
)};`;
307311

308312
response.end(

packages/react-devtools-extensions/src/main.js

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import {
1010
getAppendComponentStack,
1111
getBreakOnConsoleErrors,
1212
getSavedComponentFilters,
13+
getShowInlineWarningsAndErrors,
1314
} from 'react-devtools-shared/src/utils';
1415
import {
1516
localStorageGetItem,
@@ -29,18 +30,18 @@ let panelCreated = false;
2930
// because they are stored in localStorage within the context of the extension.
3031
// Instead it relies on the extension to pass filters through.
3132
function syncSavedPreferences() {
32-
const appendComponentStack = getAppendComponentStack();
33-
const breakOnConsoleErrors = getBreakOnConsoleErrors();
34-
const componentFilters = getSavedComponentFilters();
3533
chrome.devtools.inspectedWindow.eval(
3634
`window.__REACT_DEVTOOLS_APPEND_COMPONENT_STACK__ = ${JSON.stringify(
37-
appendComponentStack,
35+
getAppendComponentStack(),
3836
)};
3937
window.__REACT_DEVTOOLS_BREAK_ON_CONSOLE_ERRORS__ = ${JSON.stringify(
40-
breakOnConsoleErrors,
38+
getBreakOnConsoleErrors(),
4139
)};
4240
window.__REACT_DEVTOOLS_COMPONENT_FILTERS__ = ${JSON.stringify(
43-
componentFilters,
41+
getSavedComponentFilters(),
42+
)};
43+
window.__REACT_DEVTOOLS_SHOW_INLINE_WARNINGS_AND_ERRORS__ = ${JSON.stringify(
44+
getShowInlineWarningsAndErrors(),
4445
)};`,
4546
);
4647
}

packages/react-devtools-inline/src/backend.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,13 @@ function startActivation(contentWindow: window) {
2424
appendComponentStack,
2525
breakOnConsoleErrors,
2626
componentFilters,
27+
showInlineWarningsAndErrors,
2728
} = data;
2829

2930
contentWindow.__REACT_DEVTOOLS_APPEND_COMPONENT_STACK__ = appendComponentStack;
3031
contentWindow.__REACT_DEVTOOLS_BREAK_ON_CONSOLE_ERRORS__ = breakOnConsoleErrors;
3132
contentWindow.__REACT_DEVTOOLS_COMPONENT_FILTERS__ = componentFilters;
33+
contentWindow.__REACT_DEVTOOLS_SHOW_INLINE_WARNINGS_AND_ERRORS__ = showInlineWarningsAndErrors;
3234

3335
// TRICKY
3436
// The backend entry point may be required in the context of an iframe or the parent window.
@@ -40,6 +42,7 @@ function startActivation(contentWindow: window) {
4042
window.__REACT_DEVTOOLS_APPEND_COMPONENT_STACK__ = appendComponentStack;
4143
window.__REACT_DEVTOOLS_BREAK_ON_CONSOLE_ERRORS__ = breakOnConsoleErrors;
4244
window.__REACT_DEVTOOLS_COMPONENT_FILTERS__ = componentFilters;
45+
window.__REACT_DEVTOOLS_SHOW_INLINE_WARNINGS_AND_ERRORS__ = showInlineWarningsAndErrors;
4346
}
4447

4548
finishActivation(contentWindow);

packages/react-devtools-inline/src/frontend.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import {
99
getAppendComponentStack,
1010
getBreakOnConsoleErrors,
1111
getSavedComponentFilters,
12+
getShowInlineWarningsAndErrors,
1213
} from 'react-devtools-shared/src/utils';
1314
import {
1415
MESSAGE_TYPE_GET_SAVED_PREFERENCES,
@@ -41,6 +42,7 @@ export function initialize(
4142
appendComponentStack: getAppendComponentStack(),
4243
breakOnConsoleErrors: getBreakOnConsoleErrors(),
4344
componentFilters: getSavedComponentFilters(),
45+
showInlineWarningsAndErrors: getShowInlineWarningsAndErrors(),
4446
},
4547
'*',
4648
);

packages/react-devtools-shared/src/__tests__/__snapshots__/ownersListContext-test.js.snap

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,19 +12,19 @@ Array [
1212
Object {
1313
"displayName": "Grandparent",
1414
"hocDisplayNames": null,
15-
"id": 7,
15+
"id": 2,
1616
"type": 5,
1717
},
1818
Object {
1919
"displayName": "Parent",
2020
"hocDisplayNames": null,
21-
"id": 9,
21+
"id": 3,
2222
"type": 5,
2323
},
2424
Object {
2525
"displayName": "Child",
2626
"hocDisplayNames": null,
27-
"id": 8,
27+
"id": 4,
2828
"type": 5,
2929
},
3030
]
@@ -115,7 +115,7 @@ Array [
115115
Object {
116116
"displayName": "Grandparent",
117117
"hocDisplayNames": null,
118-
"id": 5,
118+
"id": 2,
119119
"type": 5,
120120
},
121121
]

packages/react-devtools-shared/src/__tests__/__snapshots__/storeComponentFilters-test.js.snap

Lines changed: 0 additions & 140 deletions
This file was deleted.

0 commit comments

Comments
 (0)