(fn, bookkeeping)
| 3631 | |
| 3632 | var isBatching = false; |
| 3633 | function batchedUpdates(fn, bookkeeping) { |
| 3634 | if (isBatching) { |
| 3635 | // If we are currently inside another batch, we need to wait until it |
| 3636 | // fully completes before restoring state. |
| 3637 | return fn(bookkeeping); |
| 3638 | } |
| 3639 | isBatching = true; |
| 3640 | try { |
| 3641 | return _batchedUpdates(fn, bookkeeping); |
| 3642 | } finally { |
| 3643 | // Here we wait until all updates have propagated, which is important |
| 3644 | // when using controlled components within layers: |
| 3645 | // https://github.com/facebook/react/issues/1698 |
| 3646 | // Then we restore state of any controlled component. |
| 3647 | isBatching = false; |
| 3648 | var controlledComponentsHavePendingUpdates = needsStateRestore(); |
| 3649 | if (controlledComponentsHavePendingUpdates) { |
| 3650 | // If a controlled event was fired, we may need to restore the state of |
| 3651 | // the DOM node back to the controlled value. This is necessary when React |
| 3652 | // bails out of the update without touching the DOM. |
| 3653 | _flushInteractiveUpdates(); |
| 3654 | restoreStateIfNeeded(); |
| 3655 | } |
| 3656 | } |
| 3657 | } |
| 3658 | |
| 3659 | function interactiveUpdates(fn, a, b) { |
| 3660 | return _interactiveUpdates(fn, a, b); |
no test coverage detected