facebook/react — pull request #115 by spicyj (2013-06-20 10:40:21+00:00)
Title: Batch together calls to setState, setProps, etc

Based off of @ngavalas's #93. Probably not quite mergeable yet but I wanted to send this out tonight and get some feedback.

The end of ReactCompositeComponent-test.js is probably most illuminating for seeing how this works.

- Should React.renderComponent take a callback?
- Should mounting and unmounting be asynchronous?
- Right now I'm not canceling the requestAnimationFrame/setTimeout if processPendingUpdates gets run sooner; assuming that we should make sure to cancel that even though processPendingUpdates is just a noop when there aren't any pending components. Maybe have some way of designating that we're going to process at the end of the current event loop and that deferring isn't necessary?
- In ReactEventEmitter, `require('ReactComponent')` at the top was giving `{}`; I assume this is due to a circular dependency or something along those lines? Not sure how to fix.
- I was thinking we could essentially sort componentsWithPendingUpdates by depth so we always process parents first, but the way I intended to do that (looking at .id) doesn't work because components don't have IDs; DOM nodes do.