(vnode, parentVNode, skipRemove)
| 643 | * current element is already detached from the DOM. |
| 644 | */ |
| 645 | export function unmount(vnode, parentVNode, skipRemove) { |
| 646 | let r; |
| 647 | if (options.unmount) options.unmount(vnode); |
| 648 | |
| 649 | if ((r = vnode.ref)) { |
| 650 | if (!r.current || r.current == vnode._dom) { |
| 651 | applyRef(r, NULL, parentVNode); |
| 652 | } |
| 653 | } |
| 654 | |
| 655 | if ((r = vnode._component) != NULL) { |
| 656 | if (r.componentWillUnmount) { |
| 657 | try { |
| 658 | r.componentWillUnmount(); |
| 659 | } catch (e) { |
| 660 | options._catchError(e, parentVNode); |
| 661 | } |
| 662 | } |
| 663 | |
| 664 | r.base = r._parentDom = r._globalContext = NULL; |
| 665 | } |
| 666 | |
| 667 | if ((r = vnode._children)) { |
| 668 | for (let i = 0; i < r.length; i++) { |
| 669 | if (r[i]) { |
| 670 | unmount( |
| 671 | r[i], |
| 672 | parentVNode, |
| 673 | skipRemove || typeof vnode.type != 'function' |
| 674 | ); |
| 675 | } |
| 676 | } |
| 677 | } |
| 678 | |
| 679 | if (!skipRemove) { |
| 680 | removeNode(vnode._dom); |
| 681 | } |
| 682 | |
| 683 | vnode._component = vnode._parent = vnode._dom = UNDEFINED; |
| 684 | } |
| 685 | |
| 686 | /** The `.render()` method for a PFC backing instance. */ |
| 687 | function doRender(props, state, context) { |
searching dependent graphs…