-
Notifications
You must be signed in to change notification settings - Fork 46.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
DevTools: Failed to execute 'postMessage' on 'Window': #<HTMLAllCollection> could not be cloned. #16691
Comments
Should be sufficient to supply a small app that uses a component with whatever prop/state is causing the error. (Shouldn't need the surrounding app or complexity.) |
To be honest I’m not sure where to begin. The component that’s causing the error is the root component of an internal library. And I can’t see inside the component for its props/state and look for irregularities because the devtools don’t work. And the error message doesn’t clue me into where this could be an issue. So I’m not sure where to start troubleshooting. Was hoping by posting here others might find the issue and be in a situation to provide more insight. Otherwise, when I find time, I could maybe just start trying to strip out props one by one and see if I can get it working. |
|
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
@Jessidhia good question. It does in fact hold a couple references to The Problem So it appears the issue stems from a part of the code that is saving an Here's an example: export default class App extends React.Component {
constructor(props) {
super(props);
this.state = {
// If you comment this out, the devtools work
// If you leave it it, the devtools break
dom: new window.DOMParser().parseFromString(
`<Candy type="snickers"></Candy>`,
"application/xml"
)
};
}
render() {
return <div>Test</div>;
}
} I put this example on codesandbox where you can test this out yourself. If you comment out the where the result of |
I don't think this is accurate? So far as I'm aware, v3 would have also failed to serialize this type of value, and a quick test using Code Sandbox and the latest version of v3 seems to confirm this. |
I'm not sure of a way to detect this type other than e.g. Maybe we could check e.g. |
I could've sworn it worked for me. So I installed an old version (
I also loaded up my example in the codesandbox and devtools v3.5.0 appear to work just fine. You can see the type So, at least on my machine, it is/was working on v3. |
Before we try to detect it — do we understand what actually causes the error? What code is trying to “clone” it? |
I'm guessing it's because devtools uses |
It's suspicious that the error is reporting window.postMessage(
new window.DOMParser().parseFromString(
`<Candy type="snickers"></Candy>`,
"application/xml"
)
);
|
It looks like this is due to how the backend identifies data types for serializing across the bridge. The I'm betting the logic isn't handling the weird |
I think what’s happening here is:
If this analysis is right, the fix would be to either add a special type for |
This is the specification for its behavior btw, unsurprisingly in Annex B: https://tc39.es/ecma262/#sec-IsHTMLDDA-internal-slot |
Yep, that’s what I meant above. This causes |
But yes, Dan's right in that the unexpected |
Today I ran into the same problem, but i didn't have any xml document parts in my code or props. This issue happens at random and don't stop until I close browser tab (reload didn't help) or reload extension
|
Any news about a fix ? |
Any news about a fix ? Making devtools unusable on my app |
If there were news about a fix, you would see them on this thread. |
@adamdva If you could provide a small repro case that captures this behavior, that would also be helpful. |
Can I take this one ? |
@omarsy If you'd like to look into this issue, please feel free. |
I was able to reproduce here: https://hzw2k.csb.app/ Source code: https://codesandbox.io/s/react-devtools-error-hzw2k?file=/src/App.js:214-250 this is obviously a silly code but that reflects a bit something that I have in my app (a dynamic ref that can set to document for global event listeners) |
Do you want to request a feature or report a bug?
Report a bug.
What is the current behavior?
New dev tools are working fine. But I have a particular component that, when it mounts, the dev tools no longer can inspect anything about it. When I select it, the right hand side just says "Loading..." and nothing ever loads.
As you can see from the gif above, before I click on that particular component that seems to break, I have no errors in my console. But as soon as I click on the component that breaks (or any of its children) the number of console errors goes up by one.
The error in the console looks like this:
Hard to provide steps to reproduce this since it's a custom component with business-specific logic (so can't provide the code). But I tried google-ing this problem and error and nothing showed up. So figured posting it here might help if others out there on the interwebs are having the same issue and they can comment here.
What is the expected behavior?
Inspecting any mounted component will work.
Which versions of React, and which browser / OS are affected by this issue? Did this work in previous versions of React?
Currently on react/react-dom 16.3 and the previous dev tools worked just fine. I could inspect any component and see it's data. But the latestest update broke that.
The text was updated successfully, but these errors were encountered: