Do you want to request a feature or report a bug?
Bug
What is the current behavior?
When a local file is loaded, the devtools extension displays a panel in devtools, but all elements are missing. There are no console warnings or errors. All elements display properly when using a server, but the documentation says a server is not necessary in this case.
If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem. Your bug will get fixed much faster if we can run your code and it doesn't have dependencies other than React. Paste the link to your JSFiddle (https://jsfiddle.net/Luktwrdm/) or CodeSandbox (https://codesandbox.io/s/new) example below:
index.html
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<title>Hello World</title>
<script src="https://unpkg.com/[email protected]/umd/react.development.js"></script>
<script src="https://unpkg.com/[email protected]/umd/react-dom.development.js"></script>
</head>
<body>
<div id="root"></div>
<script type="text/babel">
function HelloWorld() {
return React.createElement("h1", null, "Hello, world!");
}
ReactDOM.render(
React.createElement(HelloWorld, null),
document.getElementById("root")
);
</script>
</body>
</html>
index.html
What is the expected behavior?
Hello element is displayed with default settings, and both Hello and h1 are displayed when the host type is not hidden in settings.
Which versions of React, and which browser / OS are affected by this issue? Did this work in previous versions of React?
chrome.devtools.inspectedWindow.eval
is throwing:
DOMException: Failed to execute 'postMessage' on 'Window': Invalid target origin 'null' in a call to 'postMessage'.
Looks like a regression caused by #16900. Reverting that commit fixes DevTools.
cc @linshunghuang
Yes definitely caused by that change. My guess is we'll need to change the postMessage target from window.origin to '*' because origin is null for local files?
This has been fixed via #16953 and I will release an update today (4.1.3) with the fix!
Most helpful comment
chrome.devtools.inspectedWindow.eval
is throwing:Looks like a regression caused by #16900. Reverting that commit fixes DevTools.
cc @linshunghuang