(container)
| 29710 | return legacyRenderSubtreeIntoContainer(parentComponent, element, containerNode, false, callback); |
| 29711 | } |
| 29712 | function unmountComponentAtNode(container) { |
| 29713 | if (!isValidContainerLegacy(container)) { |
| 29714 | throw new Error('unmountComponentAtNode(...): Target container is not a DOM element.'); |
| 29715 | } |
| 29716 | |
| 29717 | { |
| 29718 | var isModernRoot = isContainerMarkedAsRoot(container) && container._reactRootContainer === undefined; |
| 29719 | |
| 29720 | if (isModernRoot) { |
| 29721 | error('You are calling ReactDOM.unmountComponentAtNode() on a container that was previously ' + 'passed to ReactDOMClient.createRoot(). This is not supported. Did you mean to call root.unmount()?'); |
| 29722 | } |
| 29723 | } |
| 29724 | |
| 29725 | if (container._reactRootContainer) { |
| 29726 | { |
| 29727 | var rootEl = getReactRootElementInContainer(container); |
| 29728 | var renderedByDifferentReact = rootEl && !getInstanceFromNode(rootEl); |
| 29729 | |
| 29730 | if (renderedByDifferentReact) { |
| 29731 | error("unmountComponentAtNode(): The node you're attempting to unmount " + 'was rendered by another copy of React.'); |
| 29732 | } |
| 29733 | } // Unmount should not be batched. |
| 29734 | |
| 29735 | |
| 29736 | flushSync(function () { |
| 29737 | legacyRenderSubtreeIntoContainer(null, null, container, false, function () { |
| 29738 | // $FlowFixMe This should probably use `delete container._reactRootContainer` |
| 29739 | container._reactRootContainer = null; |
| 29740 | unmarkContainerAsRoot(container); |
| 29741 | }); |
| 29742 | }); // If you call unmountComponentAtNode twice in quick succession, you'll |
| 29743 | // get `true` twice. That's probably fine? |
| 29744 | |
| 29745 | return true; |
| 29746 | } else { |
| 29747 | { |
| 29748 | var _rootEl = getReactRootElementInContainer(container); |
| 29749 | |
| 29750 | var hasNonRootReactChild = !!(_rootEl && getInstanceFromNode(_rootEl)); // Check if the container itself is a React root node. |
| 29751 | |
| 29752 | var isContainerReactRoot = container.nodeType === ELEMENT_NODE && isValidContainerLegacy(container.parentNode) && !!container.parentNode._reactRootContainer; |
| 29753 | |
| 29754 | if (hasNonRootReactChild) { |
| 29755 | error("unmountComponentAtNode(): The node you're attempting to unmount " + 'was rendered by React and is not a top-level container. %s', isContainerReactRoot ? 'You may have accidentally passed in a React root node instead ' + 'of its container.' : 'Instead, have the parent component update its state and ' + 'rerender in order to remove this component.'); |
| 29756 | } |
| 29757 | } |
| 29758 | |
| 29759 | return false; |
| 29760 | } |
| 29761 | } |
| 29762 | |
| 29763 | setAttemptSynchronousHydration(attemptSynchronousHydration$1); |
| 29764 | setAttemptContinuousHydration(attemptContinuousHydration$1); |
nothing calls this directly
no test coverage detected
searching dependent graphs…