(fn, bookkeeping)
| 3689 | |
| 3690 | var isBatching = false; |
| 3691 | function batchedUpdates(fn, bookkeeping) { |
| 3692 | if (isBatching) { |
| 3693 | // If we are currently inside another batch, we need to wait until it |
| 3694 | // fully completes before restoring state. |
| 3695 | return fn(bookkeeping); |
| 3696 | } |
| 3697 | isBatching = true; |
| 3698 | try { |
| 3699 | return _batchedUpdates(fn, bookkeeping); |
| 3700 | } finally { |
| 3701 | // Here we wait until all updates have propagated, which is important |
| 3702 | // when using controlled components within layers: |
| 3703 | // https://github.com/facebook/react/issues/1698 |
| 3704 | // Then we restore state of any controlled component. |
| 3705 | isBatching = false; |
| 3706 | var controlledComponentsHavePendingUpdates = needsStateRestore(); |
| 3707 | if (controlledComponentsHavePendingUpdates) { |
| 3708 | // If a controlled event was fired, we may need to restore the state of |
| 3709 | // the DOM node back to the controlled value. This is necessary when React |
| 3710 | // bails out of the update without touching the DOM. |
| 3711 | _flushInteractiveUpdates(); |
| 3712 | restoreStateIfNeeded(); |
| 3713 | } |
| 3714 | } |
| 3715 | } |
| 3716 | |
| 3717 | function interactiveUpdates(fn, a, b) { |
| 3718 | return _interactiveUpdates(fn, a, b); |
no test coverage detected