From 5676a486cf2e79e7ca559fc53cabdb4e12f3f4bb Mon Sep 17 00:00:00 2001 From: Pete Hunt Date: Mon, 8 Jul 2013 11:41:19 -0700 Subject: [PATCH] Allow nested ReactUpdates --- src/core/ReactUpdates.js | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/core/ReactUpdates.js b/src/core/ReactUpdates.js index fe4de4ffc2..6c2d4f675e 100644 --- a/src/core/ReactUpdates.js +++ b/src/core/ReactUpdates.js @@ -29,11 +29,13 @@ var dirtyComponents = []; * friends are batched such that components aren't updated unnecessarily. */ function batchedUpdates(callback) { - invariant( - !isBatchingUpdates, - 'batchedUpates(...): Attempt to batch updates in a context where updates ' + - 'are already being batched.' - ); + if (isBatchingUpdates) { + // We're already executing in an environment where updates will be batched, + // so this is a no-op. + callback(); + return; + } + isBatchingUpdates = true; try {