(current, finishedWork)
| 20639 | } |
| 20640 | |
| 20641 | function commitWork(current, finishedWork) { |
| 20642 | |
| 20643 | switch (finishedWork.tag) { |
| 20644 | case FunctionComponent: |
| 20645 | case ForwardRef: |
| 20646 | case MemoComponent: |
| 20647 | case SimpleMemoComponent: |
| 20648 | case Block: |
| 20649 | { |
| 20650 | // Layout effects are destroyed during the mutation phase so that all |
| 20651 | // destroy functions for all fibers are called before any create functions. |
| 20652 | // This prevents sibling component effects from interfering with each other, |
| 20653 | // e.g. a destroy function in one component should never override a ref set |
| 20654 | // by a create function in another component during the same commit. |
| 20655 | commitHookEffectListUnmount(Layout | HasEffect, finishedWork); |
| 20656 | return; |
| 20657 | } |
| 20658 | |
| 20659 | case ClassComponent: |
| 20660 | { |
| 20661 | return; |
| 20662 | } |
| 20663 | |
| 20664 | case HostComponent: |
| 20665 | { |
| 20666 | var instance = finishedWork.stateNode; |
| 20667 | |
| 20668 | if (instance != null) { |
| 20669 | // Commit the work prepared earlier. |
| 20670 | var newProps = finishedWork.memoizedProps; // For hydration we reuse the update path but we treat the oldProps |
| 20671 | // as the newProps. The updatePayload will contain the real change in |
| 20672 | // this case. |
| 20673 | |
| 20674 | var oldProps = current !== null ? current.memoizedProps : newProps; |
| 20675 | var type = finishedWork.type; // TODO: Type the updateQueue to be specific to host components. |
| 20676 | |
| 20677 | var updatePayload = finishedWork.updateQueue; |
| 20678 | finishedWork.updateQueue = null; |
| 20679 | |
| 20680 | if (updatePayload !== null) { |
| 20681 | commitUpdate(instance, updatePayload, type, oldProps, newProps); |
| 20682 | } |
| 20683 | } |
| 20684 | |
| 20685 | return; |
| 20686 | } |
| 20687 | |
| 20688 | case HostText: |
| 20689 | { |
| 20690 | if (!(finishedWork.stateNode !== null)) { |
| 20691 | { |
| 20692 | throw Error( "This should have a text node initialized. This error is likely caused by a bug in React. Please file an issue." ); |
| 20693 | } |
| 20694 | } |
| 20695 | |
| 20696 | var textInstance = finishedWork.stateNode; |
| 20697 | var newText = finishedWork.memoizedProps; // For hydration we reuse the update path but we treat the oldProps |
| 20698 | // as the newProps. The updatePayload will contain the real change in |
no test coverage detected