Unmount and then wrapper.mount() again does not work properly
- Dominant language
- JavaScript
- Stars
- 19.8k
- Forks
- 2k
- PR merge metrics
- No merged PRs in 30d
Description
Enzyme: 2.8.2
React: 15.5.4
If we do wrapper.unmount(), and then wrapper.mount(), the component is not mounted properly. I can see an empty console output after mounting again.
Simple plain example as follows
```jsx
class Foo extends React.Component {
constructor(props) {
super(props);
}
render() {
return (
{this.props.id}
);
}
}
const wrapper = mount();
console.log("log before unmounting", wrapper.mount().debug()); //This logs the component properly
wrapper.unmount();
console.log("Log again after mounting", wrapper.mount().debug());//this logs empty component
```
Contributor guide
Research direction
Start by running the provided React 15.5.4 and Enzyme 2.8.2 reproduction using mount, wrapper.unmount(), and wrapper.mount(). Trace the wrapper mount and unmount entry points to find why the second debug() is empty. Done means the component renders correctly after unmounting and mounting again, with a regression test covering the sequence.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, react
- Domain
- testing
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100