diff --git a/src/renderers/shared/fiber/ReactFiberScheduler.js b/src/renderers/shared/fiber/ReactFiberScheduler.js index cb4ab209c1..aa01b76637 100644 --- a/src/renderers/shared/fiber/ReactFiberScheduler.js +++ b/src/renderers/shared/fiber/ReactFiberScheduler.js @@ -346,7 +346,6 @@ module.exports = function(config : HostConfig(config : HostConfig { componentDidUpdate() { ops.push('componentDidUpdate', ReactNoop.findInstance(this)); } + componentWillUnmount() { + ops.push('componentWillUnmount', ReactNoop.findInstance(this)); + } render() { ops.push('render'); return this.props.step < 2 ? this.span = ref} /> : this.props.step === 2 ?
this.div = ref} /> : + this.props.step === 3 ? + null : + this.props.step === 4 ? +
this.span = ref} /> : null; } } @@ -250,7 +257,7 @@ describe('ReactIncrementalReflection', () => { // We should now find the new host node. expect(ReactNoop.findInstance(classInstance)).toBe(hostDiv); - // Finally we will render to null but not yet commit it. + // Render to null but don't commit it yet. ReactNoop.render(); ReactNoop.flushDeferredPri(25); @@ -273,7 +280,18 @@ describe('ReactIncrementalReflection', () => { // This should still be the host div since the deletion is not committed. expect(ReactNoop.findInstance(classInstance)).toBe(null); + + // Render a div again + ReactNoop.render(); + ReactNoop.flush(); + + ops = []; + + // Unmount the component. + ReactNoop.render([]); + ReactNoop.flush(); + expect(ops).toEqual([ + 'componentWillUnmount', hostDiv, + ]); }); - - });