[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
Brandon Dail committed
Jan 5, 2017 at 18:55 UTC
8095ebaae72577029e338347d45fef9a88517cba
3 files changed
+5
-1
scripts/fiber/tests-failing.txt
-1
@@ -26,7 +26,6 @@ src/renderers/dom/shared/__tests__/ReactDOMTextComponent-test.js
26
* can reconcile text arbitrarily split into multiple nodes on some substitutions only
27
28
src/renderers/dom/shared/__tests__/ReactMount-test.js
29
-* throws when given a non-node
29
* throws when given a string
30
* throws when given a factory
31
* tracks root instances
scripts/fiber/tests-passing.txt
+1
@@ -752,6 +752,7 @@ src/renderers/dom/shared/__tests__/ReactEventListener-test.js
752
* should not fire duplicate events for a React DOM tree
753
754
src/renderers/dom/shared/__tests__/ReactMount-test.js
755
+* throws when given a non-node
756
* should render different components in same root
757
* should unmount and remount if the key changes
758
* should reuse markup if rendering to the same target twice
src/renderers/dom/fiber/ReactDOMFiber.js
+4
@@ -352,6 +352,10 @@ var ReactDOM = {
352
},
353
354
unmountComponentAtNode(container : DOMContainerElement) {
355
+ invariant(
356
+ isValidContainer(container),
357
+ 'unmountComponentAtNode(...): Target container is not a DOM element.'
358
+ );
359
warnAboutUnstableUse();
360
if (container._reactRootContainer) {
361
// Unmount should not be batched.