Failed to execute 'removeChild' on 'Node': parameter 1 is not of type 'Node'. at Modal.destroy
See original GitHub issueIssue description
- components:
Modal
- reactstrap version
#5.0.0-beta.3
- import method
es
(if umd, are you using the “full” version (only for v5+)?) - react version
#16.2.0
- bootstrap version
#4.0.0
What is happening?
Error when unmounting Modal
route.
Steps to reproduce issue
1. Create the route
<Switch>
<Route
exact
path={`${this.props.match.path}/nw`}
render={(props) => (
<ComponentAsAModal
one="two"
{...props}
/>
)}
/>
</Switch>
2. The Component
// The component
class ComponentAsAModal extends React.Component {
constructor() {
super();
this.state = {
visible: true,
};
}
goBack = () => {
// Transition to another route. Apparently this is the cause
// of the error. If wrapped in `setTimeout` the error vanishes.
this.props.dispatch(push('/some-other-route'));
};
close = (e) => {
this.setState({ visible: false });
};
render() {
return (
<Modal
toggle={this.close}
isOpen={this.state.visible}
onClosed={this.goBack}
>
Modal Content
</Modal>
);
}
}
3. Click on the backdrop to trigger the transition in goBack
func.
Error message in console
Uncaught TypeError: Failed to execute 'removeChild' on 'Node': parameter 1 is not of type 'Node'. at Modal.destroy
function destroy() {
// this line fails because of `this._element`. Idealy we should test if
// `this._element` exists before executing `document.body.removeChild`
document.body.removeChild(this._element);
this._element = null;
// rest of the code
}
Issue Analytics
- State:
- Created 6 years ago
- Comments:6 (3 by maintainers)
Top Results From Across the Web
Failed to execute removeChild on Node - Stack Overflow
This works for any node (just replace markerDiv with a different node), and finds the parent of the node directly in order to...
Read more >"Failed to execute 'removeChild' on 'Node': parameter 1 is not ...
"Failed to execute 'removeChild' on 'Node': parameter 1 is not of type 'Node'." error message. I can't figure out why I am getting...
Read more >Failed to execute 'removeChild' on 'Node': parameter 1 is not ...
removeChild method removes a child node from the DOM and returns execute 'removeChild' on 'Node': parameter 1 is not of type 'Node'. Which...
Read more >Handling DOMException - Failed to execute removeChild
rubyonrails #reactwithrails #reactwithror #rorwithreact #railswithreactHello FriendsIn this lecture, we will work on fixing a DOM exception ...
Read more >VUEJS项目实践七之Failed to execute 'removeChild' on 'Node'
问题描述:Failed to execute 'removeChild' on 'Node': The node to be removed is not a child of this node.问题背景:在我之前的博文VUEJS项目 ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Uncaught TypeError: Failed to execute ‘removeChild’ on ‘Node’: parameter 1 is not of type ‘Node’.
I am getting this error so, can anyone help me sort it out?
Good catch, I’ll fix this in PR #916 - We do check for existing of element in all the other components, just need to add the one liner here. Thanks for reporting!