From 8095ebaae72577029e338347d45fef9a88517cba Mon Sep 17 00:00:00 2001 From: Brandon Dail Date: Thu, 5 Jan 2017 18:55:17 -0600 Subject: [PATCH] [Fiber] Throw when attempting to unmount at an invalid node (#8688) * Throw when attempting to unmount at an invalid node * Remove extra character after invariant --- scripts/fiber/tests-failing.txt | 1 - scripts/fiber/tests-passing.txt | 1 + src/renderers/dom/fiber/ReactDOMFiber.js | 4 ++++ 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/scripts/fiber/tests-failing.txt b/scripts/fiber/tests-failing.txt index 46e114bb24..ae1b00f2df 100644 --- a/scripts/fiber/tests-failing.txt +++ b/scripts/fiber/tests-failing.txt @@ -26,7 +26,6 @@ src/renderers/dom/shared/__tests__/ReactDOMTextComponent-test.js * can reconcile text arbitrarily split into multiple nodes on some substitutions only src/renderers/dom/shared/__tests__/ReactMount-test.js -* throws when given a non-node * throws when given a string * throws when given a factory * tracks root instances diff --git a/scripts/fiber/tests-passing.txt b/scripts/fiber/tests-passing.txt index 495ab14b83..ab34e72691 100644 --- a/scripts/fiber/tests-passing.txt +++ b/scripts/fiber/tests-passing.txt @@ -752,6 +752,7 @@ src/renderers/dom/shared/__tests__/ReactEventListener-test.js * should not fire duplicate events for a React DOM tree src/renderers/dom/shared/__tests__/ReactMount-test.js +* throws when given a non-node * should render different components in same root * should unmount and remount if the key changes * should reuse markup if rendering to the same target twice diff --git a/src/renderers/dom/fiber/ReactDOMFiber.js b/src/renderers/dom/fiber/ReactDOMFiber.js index ed27da5ee9..79ad9a28de 100644 --- a/src/renderers/dom/fiber/ReactDOMFiber.js +++ b/src/renderers/dom/fiber/ReactDOMFiber.js @@ -352,6 +352,10 @@ var ReactDOM = { }, unmountComponentAtNode(container : DOMContainerElement) { + invariant( + isValidContainer(container), + 'unmountComponentAtNode(...): Target container is not a DOM element.' + ); warnAboutUnstableUse(); if (container._reactRootContainer) { // Unmount should not be batched.