You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Dec 16, 2021. It is now read-only.
it("should unmount DOM node after changes",(done)=>{varSwapComponent=React.createClass({getInitialState(){return{activated: true};},swap(evt){evt.preventDefault();this.setState({activated: !this.state.activated});},render(){if(this.state.activated){return<aonClick={this.swap}>anchor</a>;}return<bonClick={this.swap}>bold</b>;}});varcontainer=document.createElement("div");document.body.appendChild(container);varinstance=ReactDOM.render(<SwapComponent/>,container);varel=ReactDOM.findDOMNode(instance);setTimeout(function(){trigger(el,"click");el=null;setTimeout(function(){ReactDOM.unmountComponentAtNode(container);expect(container.innerHTML).toBe("");container=null;done();},2);},2);});
Ah - great catch! preact-compat keeps a reference to the DOM element, but when that element changes it's got the wrong reference. It should retain the component instead.
Hello,
I replace react with preact-compat and I found an issue while unmounting components
jsfiddle
I also found others issues not opened at jsfiddle
The text was updated successfully, but these errors were encountered: