diff --git a/scripts/fiber/tests-failing.txt b/scripts/fiber/tests-failing.txt index 1c8799651461f..127c7dbfe9cc7 100644 --- a/scripts/fiber/tests-failing.txt +++ b/scripts/fiber/tests-failing.txt @@ -92,8 +92,6 @@ src/renderers/shared/stack/reconciler/__tests__/ReactComponentLifeCycle-test.js * should carry through each of the phases of setup src/renderers/shared/stack/reconciler/__tests__/ReactCompositeComponent-test.js -* should warn about `forceUpdate` on unmounted components -* should warn about `setState` on unmounted components * should warn about `setState` in render * should warn about `setState` in getChildContext * should update refs if shouldComponentUpdate gives false diff --git a/scripts/fiber/tests-passing-except-dev.txt b/scripts/fiber/tests-passing-except-dev.txt index 3e077e6251d3d..a5c87b20efa3e 100644 --- a/scripts/fiber/tests-passing-except-dev.txt +++ b/scripts/fiber/tests-passing-except-dev.txt @@ -162,6 +162,8 @@ src/renderers/shared/stack/reconciler/__tests__/ReactComponentLifeCycle-test.js * warns if findDOMNode is used inside render src/renderers/shared/stack/reconciler/__tests__/ReactCompositeComponent-test.js +* should warn about `forceUpdate` on unmounted components +* should warn about `setState` on unmounted components * should disallow nested render calls * should warn when mutated props are passed diff --git a/src/renderers/shared/fiber/ReactFiberScheduler.js b/src/renderers/shared/fiber/ReactFiberScheduler.js index 71aff51a26bec..f3d7c23a3d52c 100644 --- a/src/renderers/shared/fiber/ReactFiberScheduler.js +++ b/src/renderers/shared/fiber/ReactFiberScheduler.js @@ -760,7 +760,8 @@ module.exports = function(config : HostConfig) { scheduleWorkAtPriority(root, priorityLevel); return; } else { - throw new Error('Invalid root'); + // TODO: Warn about setting state on an unmounted component. + return; } } fiber = fiber.return; diff --git a/src/renderers/shared/stack/reconciler/ReactCompositeComponent.js b/src/renderers/shared/stack/reconciler/ReactCompositeComponent.js index d7ea65be32a3c..2a15d71383f62 100644 --- a/src/renderers/shared/stack/reconciler/ReactCompositeComponent.js +++ b/src/renderers/shared/stack/reconciler/ReactCompositeComponent.js @@ -678,7 +678,7 @@ var ReactCompositeComponent = { var inst = this._instance; var childContext; - if (inst.getChildContext) { + if (typeof inst.getChildContext === 'function') { if (__DEV__) { ReactInstrumentation.debugTool.onBeginProcessingChildContext(); try { @@ -689,9 +689,7 @@ var ReactCompositeComponent = { } else { childContext = inst.getChildContext(); } - } - if (childContext) { invariant( typeof Component.childContextTypes === 'object', '%s.getChildContext(): childContextTypes must be defined in order to ' + diff --git a/src/renderers/shared/stack/reconciler/__tests__/ReactCompositeComponent-test.js b/src/renderers/shared/stack/reconciler/__tests__/ReactCompositeComponent-test.js index 4fcc514b3b1fe..2698783958a95 100644 --- a/src/renderers/shared/stack/reconciler/__tests__/ReactCompositeComponent-test.js +++ b/src/renderers/shared/stack/reconciler/__tests__/ReactCompositeComponent-test.js @@ -427,6 +427,7 @@ describe('ReactCompositeComponent', () => { return
; } } + Component.childContextTypes = {}; expectDev(console.error.calls.count()).toBe(0); var instance = ReactDOM.render(, container);