diff --git a/scripts/fiber/tests-passing.txt b/scripts/fiber/tests-passing.txt index b2952dfe3d3..22f7c05f6dc 100644 --- a/scripts/fiber/tests-passing.txt +++ b/scripts/fiber/tests-passing.txt @@ -1174,6 +1174,7 @@ src/renderers/shared/fiber/__tests__/ReactIncremental-test.js * maintains the correct context when providers bail out due to low priority * maintains the correct context when unwinding due to an error in render * should not recreate masked context unless inputs have changed +* should reuse memoized work if pointers are updated before calling lifecycles src/renderers/shared/fiber/__tests__/ReactIncrementalErrorHandling-test.js * catches render error in a boundary during full deferred mounting diff --git a/src/renderers/shared/fiber/__tests__/ReactIncremental-test.js b/src/renderers/shared/fiber/__tests__/ReactIncremental-test.js index b2701d76bdb..7c3783e7427 100644 --- a/src/renderers/shared/fiber/__tests__/ReactIncremental-test.js +++ b/src/renderers/shared/fiber/__tests__/ReactIncremental-test.js @@ -2184,4 +2184,87 @@ describe('ReactIncremental', () => { 'componentDidUpdate', ]); }); + + it('should reuse memoized work if pointers are updated before calling lifecycles', () => { + let cduNextProps = []; + let cduPrevProps = []; + let scuNextProps = []; + let scuPrevProps = []; + let renderCounter = 0; + + function SecondChild(props) { + return {props.children}; + } + + class FirstChild extends React.Component { + componentDidUpdate(prevProps, prevState) { + cduNextProps.push(this.props); + cduPrevProps.push(prevProps); + } + shouldComponentUpdate(nextProps, nextState) { + scuNextProps.push(nextProps); + scuPrevProps.push(this.props); + return this.props.children !== nextProps.children; + } + render() { + renderCounter++; + return {this.props.children}; + } + } + + class Middle extends React.Component { + render() { + return ( +