-
Notifications
You must be signed in to change notification settings - Fork 47.8k
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
Bug: Uncaught Error: Unable to find node on an unmounted component in react 17.0.1 #20131
Comments
Please provide a CodeSandbox (https://codesandbox.io/s/new), a link to a repository on GitHub, or provide a minimal code example that reproduces the problem. Screenshots or videos can also be helpful if they help provide context on how to repro the bug. Here are some tips for providing a minimal example: https://stackoverflow.com/help/mcve |
Here is very simple code sandbox for issue: |
The async wrapper around class Tree extends Component {
constructor(props) {
super(props);
this.state = {
treeData: [
{
id: 1,
name: "test",
parent_id: null,
_lft: 1,
_rgt: 2,
children: []
}
]
};
}
render() {
return (
<SortableTree
style={{ height: "300px" }}
treeData={this.state.treeData}
onChange={(treeData) => this.setState({ treeData })}
/>
);
}
} Does seem to work as expected with v16 though. Not sure it's a React bug or not, but warrants further investigation! |
async was wrapper for handling server data fetching that in code sandbox I simplified it, but as you mentioned I moved treeData to initial state and error again appeared! It seems that problem is related to react-dom package. |
Maybe 😄 Or maybe the tree component. Needs investigation :) |
@payamdvpl I submitted an issue over on react-sortable-tree, I just did a project update to react 17 and got same error. 😄 |
Same here https://stackoverflow.com/questions/64566527/react-native-test-error-unable-to-find-node-on-an-unmounted-component/ (error is gone running react-test-renderer@16 and react@17 and react-dom@17) |
Error exists in react version 17, but react 16 is fine, check my code sandbox: |
You are going to want to follow the this issue frontend-collective/react-sortable-tree#821 , |
To diagnose the issue, the most helpful thing will be to extract a CodeSandbox that doesn't use any third-party npm libraries. |
This comment has been minimized.
This comment has been minimized.
I'm going to close because we haven't gotten reduced reproducing cases that don't include third party libraries, as we requested. |
I reproduce this when my dependencies packageA depend on React16, and my project depend on React17, the ReactDOM.findDOMNode is called in packageA. myProject/package.json
packageA/package.json
when I replace myProject to React16, it works. so, I think there something wrong with build work. Then, I found js in browser refer to different React/ReactDOM. then I config webpack.config.js like (webpack/webpack#6505):
It is solved. |
@gaearon I don't understand closing this due to reproducing without a 3rd party library, when the issue is a react 17 project using a react 16 library. Seems like there are multiple examples of this mentioned. I have a homegrown library that I've used in a couple react 16.13.1 projects and it works fine. I just tried to pull it into a new project that is 17.0.2 and hit this error exercising the component in storybook. So far the only straightforward solution looks like downgrading the new project from react 17 to 16. I used create-react-app and would rather not mess with webpack configuration. Any other non-library specific solutions? |
I encountered this issue in the monorepo which had a single version of |
The same problem here. I'm trying to upgrade my project to v. 17, but I get this error while using react-simple-popover. |
Hi, I used react-sortable-tree package im my react project in component named Tree:
when I use Tree component in my code it works pretty well in react 16.13.1, but fails and get this error is react 17.0.1:
`←→1 of 2 errors on the page
Error: Unable to find node on an unmounted component.
▶ 21 stack frames were collapsed.
(anonymous function)
src/components/utility/Tree.js:114
111 | console.log(result);
112 | if (result.data.done === true) {
113 | //console.log(result.data.tree);
The text was updated successfully, but these errors were encountered: