Issue 1:
Issue

Using latest .14.7 I'm running into an issue error with select and ReactDOMSelect:158 when navigating away from one place to another place which is causing a select to throw even though it should and is unmounted.

Error being: TypeError: Cannot set property 'initialValue' of null at Object.ReactDOMSelect.postUpdateWrapper (http://localhost:3992/assets/js/main.js:22153:38)

Other reports of this happening are here redux-form/redux-form#321

Setup

Currently integrating into an app in pieces, So I render our Router into an empty container that renders components that render into their appropriate DOM containers.

Seemingly the error?

I've narrowed it down to calling unmountComponentAtNode(this.section) which occurs in a componentDidUpdate. I removed it and the error stops happening.

I realize that mounting to an existing node that is a React root will cause an unmount and mount the correct things.

Repro

I've attempted to reproduce it but no luck at the moment even though I've narrowed it down to the unmountComponentAtNode call.

The click is originating in a different ReactDOM.render container so I'm not sure if it is an eventing thing where clicks from different ReactDOM roots are applying to everywhere else?

Stack Trace

ReactDOMSelect.postUpdateWrapper (ReactDOMSelect.js:158)
postUpdateSelectWrapper (ReactDOMComponent.js:303)
assign.notifyAll (CallbackQueue.js:65)
ON_DOM_READY_QUEUEING.close (ReactReconcileT…nsaction.js:81)
Mixin.closeAll (Transaction.js:202)
Mixin.perform (Transaction.js:149)
Mixin.perform (Transaction.js:136)
assign.perform (ReactUpdates.js:86)
flushBatchedUpdates (ReactUpdates.js:147)
ReactUpdates_flushBatchedUpdates (ReactPerf.js:66)
Mixin.closeAll (Transaction.js:202)
Mixin.perform (Transaction.js:149)
ReactDefaultBatchingStrategy.batchedUpdates (ReactDefaultBat…Strategy.js:62)
batchedUpdates (ReactUpdates.js:94)
ReactEventListener.dispatchEvent (ReactEventListener.js:204) //Mouse click event of me clicking on a different container render.

Code

My code causing the issue looks like so.

import React, { Component, PropTypes } from "react";
import { render, unmountComponentAtNode } from "react-dom";
import { Provider } from "react-redux";
import ApplicationsRenderer from "./applications";

let getContainer = () => document.getElementById('dashboard-body');

export default class DashboardRenderer extends Component {

constructor(props, context) {
super(props, context);
this.renderIntoContainer = this.renderIntoContainer.bind(this);
}
componentDidMount() {
this.renderIntoContainer();
}

renderIntoContainer() {
let { store, container: Container } = this.props.route;
let { router } = this.context;
this.section = getContainer();
if (this.section) {
unmountComponentAtNode(this.section)
render(
<Provider store={store}>
<Container router={router} key={Container} />
</Provider>,
this.section
);
}
}

componentDidUpdate(prevProps) {
let { container } = this.props.route;
let { container: prevContainer } = prevProps.route;

if (container !== prevContainer) {
this.renderIntoContainer();
}
}

componentWillUnmount() {
unmountComponentAtNode(this.section)
}

render() {
return null;
}
}

DashboardRenderer.contextTypes = {
router: PropTypes.object
}

Issue 2:
Hi,

When trying to unmount my whole app, I got some error.

Uncaught TypeError: Cannot read property 'firstChild' of undefined

ReactMount.js:606ReactMount.findComponentRoot

ReactMount.js:606ReactMount.findReactNodeByID ReactMount.js:552getNode

ReactMount.js:128executeDispatch EventPluginUtils.js:109SimpleEventPlugin.executeDispatch

SimpleEventPlugin.js:305forEachEventDispatch EventPluginUtils.js:95executeDispatchesInOrder

EventPluginUtils.js:119executeDispatchesAndRelease EventPluginHub.js:46forEachAccumulated

forEachAccumulated.js:25EventPluginHub.processEventQueue

EventPluginHub.js:251runEventQueueInBatch

ReactEventEmitterMixin.js:18ReactEventEmitterMixin.handleTopLevel

ReactEventEmitterMixin.js:44handleTopLevelImpl ReactEventListener.js:80Mixin.perform

Transaction.js:134ReactDefaultBatchingStrategy.batchedUpdates

ReactDefaultBatchingStrategy.js:66batchedUpdates

ReactUpdates.js:109ReactEventListener.dispatchEvent ReactEventListener.js:175

I think it's not a big deal.

According to what I see with the debugger, it seems to be because a SyntheticMouseEvent is trying to get dispatched. And I guess the target has just been unmounted...

Note that my use case looks like this:

var Hello = React.createClass({
render: function() {
return <div onClick={unmount}>Hello {this.props.name}</div>;
}
});

When using an unmount synchronous implementation, I get this error.

When adding a setTimeout 0 in the unmount code, I got no error.

I could not reproduce this in a jsfiddle, but I guess it's probably because I don't really know how batching work in React.