dillon1000/react
Commit
Browse files Move memoization to begin phase
Currently we update the memoized inputs (props, state) during the complete phase, as we go back up the tree. That means we can't reuse work until of its children have completed. By moving memoization to the begin phase, we can do a shallow bailout, reusing a unit of work even if there's still work to do in its children. Memoization now happens whenever a fiber's `child` property is updated; typically, right after reconciling. It's also updated when `shouldComponentUpdate` returns false, because that indicates that the given state and props are equal to the memoized state and props.
Changed paths8 files
First-parent comparisonscripts/fiber/tests-failing.txt ModifiedM scripts/fiber/tests-passing.txt ModifiedM src/renderers/shared/fiber/ReactFiberBeginWork.js ModifiedM src/renderers/shared/fiber/ReactFiberClassComponent.js ModifiedM src/renderers/shared/fiber/ReactFiberCompleteWork.js ModifiedM src/renderers/shared/fiber/ReactFiberScheduler.js ModifiedM src/renderers/shared/fiber/__tests__/ReactIncremental-test.js ModifiedM src/renderers/shared/fiber/__tests__/ReactIncrementalSideEffects-test.js ModifiedPatch
Files changed
Rendering syntax-highlighted changes…